123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?php
- /**
- * Created by PhpStorm.
- * User: kang
- * Date: 2021/3/8
- * Time: 16:29
- */
- namespace JinDouYun\Controller\Customer;
- use JinDouYun\Controller\Market\VipCard;
- use JinDouYun\Model\Customer\MCustomer;
- use Mall\Framework\Core\ErrorCode;
- use Mall\Framework\Core\StatusCode;
- use JinDouYun\Controller\BaseController;
- use JinDouYun\Model\Customer\MCustomerDemand;
- class CustomerDemand extends BaseController
- {
- private $objMCustomerDemand;
- public function __construct($isCheckAcl = true, $isMustLogin = true)
- {
- parent::__construct($isCheckAcl, $isMustLogin);
-
- $this->objMCustomerDemand = new MCustomerDemand($this->onlineEnterpriseId, $this->onlineUserId);
- }
- /**
- * 编辑客户需求提报管理公共字段处理方法
- *
- * @return array
- */
- public function commonFieldFilter()
- {
- $params = $this->request->getRawJson();
-
- if (empty($params)) {
- $this->sendOutput('参数为空', ErrorCode::$paramError);
- }
- $demandData = [
- 'enterpriseId' => $this->onlineEnterpriseId,
- 'customerId' => getArrayItem($params,'customerId'),
- 'demand' => getArrayItem($params,'demand'),
- ];
- $demandData['updateTime'] = time();
- foreach ($demandData as $key => $value) {
- if (empty($value) && $value !== 0) {
- $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
- }
- }
- return $demandData;
- }
-
- /**
- * 获取所有的客户需求提报
- */
- public function getAllCustomerdemand()
- {
- $params = $this->request->getRawJson();
- if (empty($params)) {
- $this->sendOutput('参数为空', ErrorCode::$paramError);
- }
- $pageParams = pageToOffset($params['page'] ?: 1, $params['pageSize'] ?: 10);
- $params['limit'] = $pageParams['limit'];
- $params['offset'] = $pageParams['offset'];
-
- $returnData = $this->objMCustomerDemand->getAllCustomerdemand($params);
- if ($returnData->isSuccess()) {
- $returnData = $returnData->getData();
- $pageData = [
- 'pageIndex' => $params['page'],
- 'pageSize' => $params['pageSize'],
- 'pageTotal' => $returnData['total'],
- ];
- parent::sendOutput($returnData['data'], 0, $pageData);
- } else {
- parent::sendOutput($returnData->getData(), ErrorCode::$dberror);
- }
- }
-
- /**
- * 获取指定的客户需求提报
- */
- public function getCustomerdemandInfo()
- {
- $customerdemandId = $this->request->param('request_id');
- if (!$customerdemandId) {
- $this->sendOutput('参数错误', ErrorCode::$paramError);
- }
-
- $result = $this->objMCustomerDemand->getCustomerdemandInfo($customerdemandId);
-
- if ($result->isSuccess()) {
- $this->sendOutput($result->getData());
- } else {
- $this->sendOutput($result->getData(), $result->getErrorCode());
- }
- }
-
-
- }
|