onlineUserId = $onlineUserId; $this->onlineEnterpriseId = $onlineEnterpriseId; $this->objDCashierGuide = new DCashierGuide(); $this->objDCashierGuide->setTable('qianniao_cashier_guide_'.$this->onlineEnterpriseId); } /** * Doc: (des="导购员列表") * User: XMing * Date: 2020/8/31 * Time: 3:44 下午 * @param array $selectParams * @return ResultWrapper * */ public function getAll(array $selectParams) { $fields = 'id,name,mobile,enableStatus,createTime'; $sql = 'SELECT '.$fields.' FROM qianniao_cashier_guide_'.$this->onlineEnterpriseId.' WHERE deleteStatus = '.StatusCode::$standard.' ORDER BY createTime DESC'; $count = count((array)$this->objDCashierGuide->query($sql)); $sql .= ' LIMIT '.$selectParams['offset'].','.$selectParams['limit']; $list = $this->objDCashierGuide->query($sql); if ($list === false){ return ResultWrapper::fail($this->objDCashierGuide->error(),ErrorCode::$dberror); } $ret = [ 'total' => $count, 'data' => $list ]; return ResultWrapper::success($ret); } /** * Doc: (des="添加导购") * User: XMing * Date: 2020/8/31 * Time: 4:41 下午 * @param array $params * @return ResultWrapper */ public function add(array $params) { $guideInfo = $this->objDCashierGuide->get(['mobile' => $params['mobile'],'deleteStatus' => StatusCode::$standard]); if (!empty($guideInfo)){ return ResultWrapper::fail('手机号码已存在',ErrorCode::$paramError); } $insert = [ 'name' => $params['name'], 'mobile' => $params['mobile'], 'enableStatus' => $params['enableStatus'], 'isSetRule' => $params['isSetRule'] ]; $params['isSetRule'] == StatusCode::$standard && $insert['rule'] = $params['rule']; $result = $this->objDCashierGuide->insert($insert); if ($result === false){ return ResultWrapper::fail($this->objDCashierGuide->error(),ErrorCode::$paramError); } return ResultWrapper::success(true); } /** * Doc: (des="") * User: XMing * Date: 2020/9/1 * Time: 9:35 上午 * @param int $id * @return ResultWrapper */ public function getInfo(int $id) { $this->objDCashierGuide->get(['id'=>$id]); return ResultWrapper::success([]); } }