| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?php
- namespace ghs\controllers;
- use biz\saas\classes\ApplyExtendClass;
- use bizTy\sj\classes\MerchantClass;
- use biz\saas\classes\ApplyClass;
- use biz\saas\services\ApplyService;
- use bizGhs\custom\classes\CustomClass;
- use bizGhs\custom\services\CustomService;
- use common\components\stringUtil;
- use common\components\util;
- use Yii;
- use yii\web\Controller;
- class CustomController extends BaseController
- {
-
- //客户列表 shish 2021.7.8
- public function actionList()
- {
- $get = Yii::$app->request->get();
- $type = isset($get['type']) ? $get['type'] : 0;
- $name = isset($get['name']) ? $get['name'] : '';
- $where = ['sjId' => $this->sjId];
- switch ($type) {
- case 1:
- //已开店
- $where['isOpen'] = 1;
- break;
- default:
- }
- if (!empty($name)) {
- if (stringUtil::isMobile($name)) {
- $where['mobile'] = $name;
- } else {
- $where['shopName'] = ['like', $name];
- }
- }
- $list = CustomService::getCustomList($where);
- util::success($list);
- }
-
- //客户详情 shish 2021.1.8
- public function actionDetail()
- {
- $get = Yii::$app->request->get();
- $customId = $get['id'] ?? 0;
- $info = CustomService::getCustomInfo($customId);
- CustomClass::valid($info, $this->sjId);
- $info['sn'] = 1254358;
- util::success($info);
- }
-
- //允许月结开关 shish 2021.1.8
- public function actionDebt()
- {
- $get = Yii::$app->request->get();
- $debt = isset($get['debt']) ? $get['debt'] : 0;
- $customId = isset($get['customId']) ? $get['customId'] : 0;
- $custom = CustomClass::getById($customId);
- CustomClass::valid($custom, $this->sjId);
- CustomClass::debt($custom, $debt);
- util::complete();
- }
-
- //添加新客户 shish 2021.1.8
- public function actionAdd()
- {
- $post = Yii::$app->request->post();
- $post['style'] = MerchantClass::STYLE_RETAIL;
- $post['from'] = ApplyClass::FROM_GHS;
- $post['introSjId'] = $this->sjId;
- $post['introStyle'] = MerchantClass::STYLE_SUPPLIER;
- $post['certType'] = ApplyExtendClass::CERT_TYPE_MOBILE;
- $mobile = $post['mobile'] ?? '';
- $confirmMobile = $post['confirmMobile'];
- if (stringUtil::isMobile($mobile) == false) {
- util::fail(' 请填写正确的手机号');
- }
- if ($mobile != $confirmMobile) {
- util::fail('二次号码填写不一致');
- }
- $extend = ApplyExtendClass::getByCondition(['certType' => ApplyExtendClass::CERT_TYPE_MOBILE, 'mobile' => $mobile]);
- if (!empty($extend)) {
- util::fail('此客户已存在');
- }
- ApplyService::addApply($post);
- util::complete('添加成功,等待审核');
- }
- //欠款客户 shish 2021.2.4
- public function actionDebtList()
- {
- $get = Yii::$app->request->get();
- $where = ['merchantId' => $this->sjId, 'isDebt' => 1];
- if (isset($get['name']) && !empty($get['name'])) {
- $where['name'] = ['like', $get['name']];
- }
- $list = CustomService::getDebtList($where);
- util::success($list);
- }
- }
|