_Account = $this->getKey($this->_apiCode); //验证是否具有访问这个接口的权限 if(!isset($this->_Account['Sales'])){ HelperService::returnJson(['code'=>400,'msg'=>'sales interface unauthorized access','data'=>[]]); } } /** * 入队列 */ public function pushSales(){ $params = $this->_params; $rule = [ 'company_no|集团编号'=>'require|max:100', 'store_no|门店编号'=>'require|max:100', 'sales_no|销售单号'=>'require|max:100', 'sales_detail|销售明细'=>'require|array', 'other|其他备注信息'=>'array' ]; $validate = new Validate($rule); if(!$validate->check($params)){ HelperService::returnJson(['code'=>400,'msg'=>$validate->getError(),'data'=>[]]); } if(!empty($params['detail'])){ foreach($params['detail'] as $detail){ if(!isset($detail['product_no']) || !isset($detail['sales_num']) || !isset($detail['is_refund'])){ HelperService::returnJson(['code'=>400,'msg'=>"销售明细不合法",'data'=>[]]); } } } $this->connectionRedis(); $this->_redisClient->lpush($this->_redisKey, json_encode($params)); HelperService::returnJson(['code'=>200,'msg'=>'success','data'=>[]]); } }