123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- <?php
- namespace JinDouYun\Controller\Holders;
- use JinDouYun\Controller\BaseController;
- use JinDouYun\Model\Customer\MCustomer;
- use JinDouYun\Model\Department\MStaff;
- use JinDouYun\Model\Holders\Holders as MHolders;
- use Mall\Framework\Core\ErrorCode;
- use Mall\Framework\Core\StatusCode;
- //股东管理
- class Holders extends BaseController
- {
- private $objMHolders;
- public function __construct($isCheckAcl = true, $isMustLogin = true)
- {
- parent::__construct($isCheckAcl, $isMustLogin);
- $this->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());
- }
- }
- }
|