objMHolders = new MHolders($this->onlineEnterpriseId); } // 添加股东 public function add() { $name = $this->request->param('name'); $number = $this->request->param('number'); $address = $this->request->param('address'); $remk = $this->request->param('remk'); $id = $this->request->param('id'); if ($name == '' || $number == '' || $address == '') $this->sendOutput('参数错误', ErrorCode::$paramError); $data = [ 'name' => $name, 'number' => $number, 'address' => $address, 'remk' => $remk, 'updateTime' => Date('Y-m-d H:i:s', time()), 'id' => $id ]; //添加股东 if(empty($data["id"])){ //初始化股东信息 $data["shares"]=0; $data["dends"]=0; $data["createTime"]=Date('Y-m-d H:i:s', time()); $data["en_id"]=$this->onlineEnterpriseId; $staff = new MCustomer($this->onlineEnterpriseId, $this->onlineUserId); $param = [ 'mobile' => $number, 'name' => $name, 'type' => 1, 'enableStatus' => 5, 'contact' => array ( 'area' => '', 'name' => '', 'mobile' => $number, 'provinceCode' => '', 'cityCode' => '', 'districtCode' => '', 'address' => '', ), 'is_shareholder'=> 1, 'provinceCode' => '', 'cityCode' => '', 'districtCode' => '', 'shopId' => '', 'longitude' => '', 'latitude' => '', 'password' => '', 'address' => '', 'managerMobile' => $number, 'avatar' => '', 'departmentId' => '', 'salesManId' => '', 'salesManCode' => '', 'salesManName' => '', 'birthday' => 0, 'remark' => '', 'deleteStatus' => 5, 'status' => '', 'reservoirId' => '', 'extend' => json_encode(['license' => '']), 'memberBalance' => '', 'recommenderType' => 3, 'recommenderId' => '', 'createTime' => time(), 'updateTime' => time(), ]; $res1 = $staff->addCustomer($param)->getData(); $data['us_id'] = $res1; } $res = $this->objMHolders->add($data); if ($res) { parent::sendOutput('添加成功'); } else { parent::sendOutput('添加失败', ErrorCode::$paramError); } } // 获取股东信息 public function Getinfo() { $id = $this->request->param('id'); if (empty($id)) { $this->sendOutput('参数为空', ErrorCode::$paramError); } $params['id'] = intval($id); $params['en_id'] = $this->onlineEnterpriseId; $result = $this->objMHolders->getinfo($params); if ($result->isSuccess()) { parent::sendOutput($result->getData()); } else { parent::sendOutput($result->getData(), $result->getErrorCode()); } } // 获取股东列表 public function Lst() { $params = $this->request->getRawJson(); if (empty($params)) { parent::sendOutput('参数为空', ErrorCode::$paramError); } $pageParams = pageToOffset($params['page'] ?: 1, $params['pageSize'] ?: 10); $selectParams['limit'] = $pageParams['limit']; if (isset($params['createTime']) && !empty($params['createTime'])) { $selectParams['createTime'] = $params['createTime']; } if (!empty($this->onlineEnterpriseId)) { $selectParams['en_id'] = $this->onlineEnterpriseId; } $result = $this->objMHolders->lst($selectParams); if ($result->isSuccess()) { $returnData = $result->getData(); $pageData = [ 'pageIndex' => $params['page'], 'pageSize' => $params['pageSize'], 'pageTotal' => $returnData['total'], ]; parent::sendOutput($returnData['data'], 0, $pageData); } else { parent::sendOutput($result->getData(), ErrorCode::$dberror); } } /** * 增加减少股份 * @return void */ public function edit_shares() { $param = $this->request->getRawJson(); if (empty($param['type'])) parent::sendOutput('选择类型', ErrorCode::$dberror); if (empty($param['number'])) parent::sendOutput('填写修改数量', ErrorCode::$dberror); if (empty($param['pm'])) parent::sendOutput('选择增减', ErrorCode::$dberror); if (empty($param['id'])) parent::sendOutput('参数为空', ErrorCode::$dberror); $res = $this->objMHolders->edit_shares($param); if ($res) { parent::sendOutput('修改成功'); } parent::sendOutput('修改失败', ErrorCode::$dberror); } /** * 详情 * @return void */ public function details() { $where = []; $id = $this->request->param('id'); if(!empty($id)){ $where['id'] = $id; } $result = $this->objMHolders->details($where); if ($result->isSuccess()) { parent::sendOutput($result->getData()); } else { parent::sendOutput($result->getData(), $result->getErrorCode()); } } public function delete() { $id['id'] = $this->request->param('id'); if (empty($id['id'])) { $this->sendOutput('参数为空', ErrorCode::$paramError); } $result = $this->objMHolders->delete($id); if ($result->isSuccess()) { parent::sendOutput($result->getData()); } else { parent::sendOutput($result->getData(), $result->getErrorCode()); } } }