12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- /**
- * 客户余额管理模块
- * Created by PhpStorm.
- * User: tpl
- * Date: 2019/10/30
- * Time: 13:54
- */
- namespace JinDouYun\Controller\Finance;
- use Mall\Framework\Core\ErrorCode;
- use Mall\Framework\Core\StatusCode;
- use JinDouYun\Controller\BaseController;
- use JinDouYun\Model\Finance\MCustomerBalance;
- class CustomerBalance extends BaseController
- {
- private $objMCustomerBalance;
- public function __construct($isCheckAcl = true, $isMustLogin = true)
- {
- parent::__construct($isCheckAcl, $isMustLogin);
- $this->objMCustomerBalance = new MCustomerBalance($this->onlineEnterpriseId, $this->onlineUserId);
- }
- //测试勿用
- public function addCustomerBalance() {
- $result = $this->objMCustomerBalance->addCustomerBalance(6,-100);
- V($result);
- }
- /**
- * 后台所有客户余额列表
- */
- public function getAllCustomerBalance()
- {
- $params = $this->request->getRawJson();
- if (empty($params)) {
- $this->sendOutput('参数为空', ErrorCode::$paramError);
- }
- //接收客户Id
- //接收开始日期和结束日期
- $selectParams = [
- 'customerId' => isset($params['customerId']) ? $params['customerId'] : '',
- 'start' => isset($params['start']) ? $params['start'] : '',
- 'end' => isset($params['end']) ? $params['end'] : ''
- ];
- if($selectParams['start'] && $selectParams['end']) {
- if(empty($selectParams['customerId'])) {
- $this->sendOutput('请选择客户', ErrorCode::$paramError);
- }
- }
- $pageParams = pageToOffset($params['page'] ?: 1, $params['pageSize'] ?: 10);
- $selectParams['limit'] = $pageParams['limit'];
- $selectParams['offset'] = $pageParams['offset'];
- $selectParams['tag'] = isset($params['tag']) ? $params['tag'] : '';//有无财产纠纷 5有 4没有
- $export = isset($params['export']) ? $params['export'] : 0;
- $result = $this->objMCustomerBalance->getAllCustomerBalance($selectParams,$export);
- 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(), $result->getErrorCode());
- }
- }
- }
|