['name' => '普店', 'num' => 0, 'amount' => 0, 'key' => ''], 'hj' => ['name' => '银店', 'num' => 0, 'amount' => 0, 'key' => 'hj'], 'zs' => ['name' => '金店', 'num' => 0, 'amount' => 0, 'key' => 'zs'], ]; //供应商列表 ssh 2021.1.24 public function actionList() { $where = []; $where['ownShopId'] = $this->shopId; $respond = GhsClass::getGhsList($where); util::success($respond); } //详情 ssh 2021.4.11 public function actionDetail() { $id = Yii::$app->request->get('id'); $info = GhsClass::getGhsInfo($id); $giveLevel = $info['giveLevel'] ?? 0; $levelMap = CustomClass::$nickNameMap; $giveLevelName = $levelMap[$giveLevel] ?? '散客'; $info['giveLevelName'] = $giveLevelName; GhsClass::valid($info, $this->shopId); //是否有充值送红包活动 $ghsShopId = $info['shopId'] ?? 0; $ghsShop = ShopClass::getById($ghsShopId, true); $info['hasRechargeHb'] = $ghsShop->recharge ?? 0; $hb = RechargeHbClass::getByCondition(['shopId' => $ghsShopId, 'delStatus' => 0], true, 'totalHb DESC'); $info['hasRechargeHbAmount'] = $hb->totalHb ?? 0; $info['xrFl'] = $ghsShop->xrFl ?? 0; $info['xrFlAmount'] = $ghsShop->xrFlAmount ?? 0; $info['tjFl'] = $ghsShop->tjFl ?? 0; $info['tjFlAmount'] = $ghsShop->tjFlAmount ?? 0; //预订单的最低公斤数和每公斤服务费 $info['kiloFee'] = $ghsShop->kiloFee ?? 0; $info['miniKilo'] = $ghsShop->miniKilo ?? 0; util::success($info); } //根据门店获取供应商信息 ssh 2021.4.14 public function actionInfo() { $shopId = Yii::$app->request->get('shopId'); if (isset($this->shopId) && !empty($this->shopId)) { $ghs = GhsClass::build($shopId, $this->shopId); //是否有充值送红包活动 $ghsShopId = $ghs['shopId'] ?? 0; $ghsShop = ShopClass::getById($ghsShopId, true); $ghs['hasRechargeHb'] = $ghsShop->recharge ?? 0; $hb = RechargeHbClass::getByCondition(['shopId' => $ghsShopId, 'delStatus' => 0], true, 'totalHb DESC'); $ghs['hasRechargeHbAmount'] = $hb->totalHb ?? 0; $avatar = $ghs['avatar'] ?? ''; $ghs['avatar'] = imgUtil::groupImg($avatar); $map = CustomClass::$nickNameMap; $giveLevel = $ghs['giveLevel'] ?? 0; $ghs['giveLevelName'] = $map[$giveLevel] ?? ''; $ghs['xrFl'] = $ghsShop->xrFl ?? 0; $ghs['xrFlAmount'] = $ghsShop->xrFlAmount ?? 0; $ghs['tjFl'] = $ghsShop->tjFl ?? 0; $ghs['tjFlAmount'] = $ghsShop->tjFlAmount ?? 0; } else { //没有开店也给显示供应商信息 $shop = ShopClass::getShopInfo($shopId); $shopName = $shop['shopName'] ?? ''; $sjName = $shop['merchantName'] ?? ''; $avatar = $shop['avatar'] ?? ''; $default = $shop['default'] ?? 0; $name = $default == 1 ? $sjName : $sjName . ' ' . $shopName; $ghs = [ 'id' => 0, 'name' => $name, 'debtAmount' => 0.00, 'expendAmount' => 0.00, 'giveLevel' => 0, 'giveLevelName' => '普通', 'xrFl' => 0, 'xrFlAmount' => 0, 'tjFl' => 0, 'tjFlAmount' => 0, 'avatar' => $avatar, ]; } util::success($ghs); } //获取客户等级 ssh 20211016 public function actionGetCustomLevel() { $id = Yii::$app->request->get('id'); $info = GhsClass::getById($id, true); GhsClass::valid($info, $this->shopId); $ghsShopId = $info->shopId ?? 0; $info = CustomLevelClass::getByCondition(['shopId' => $ghsShopId]); $map = self::$levelMap; foreach ($map as $key => $val) { $flag = $val['key'] ?? ''; if (empty($flag)) { $map[$key]['num'] = $info["num"] ?? 0; $map[$key]['amount'] = $info["amount"] ?? 0; } else { $map[$key]['num'] = $info[$flag . "Num"] ?? 0; $map[$key]['amount'] = $info[$flag . "Amount"] ?? 0; } } util::success(['list' => $map]); } //访问供货商的商城 ssh 20211022 public function actionVisitMall() { $id = Yii::$app->request->get('id'); $info = GhsClass::getById($id, true); GhsClass::valid($info, $this->shopId); $customId = $info->customId ?? 0; $custom = CustomClass::getById($customId, true); if (empty($custom)) { util::fail('没有找到客户'); } StatVisitClass::addGhsCustomVisit($info, $custom); util::complete(); } //补充缺失的供货商 ssh 20211027 public function actionBcGhs() { util::fail('过几天再试'); GhsClass::bcGhs($this->shopId); util::complete('载入成功'); } }