['name' => '青铜', 'num' => 0, 'amount' => 0], 'by' => ['name' => '白银', 'num' => 0, 'amount' => 0], 'hj' => ['name' => '黄金', 'num' => 0, 'amount' => 0], 'zs' => ['name' => '钻石', 'num' => 0, 'amount' => 0], ]; //供应商列表 ssh 2021.1.24 public function actionList() { $where = []; $where['ownShopId'] = $this->shopId; $respond = GhsClass::getGhsList($where); util::success($respond); } //详情 shish 2021.4.11 public function actionDetail() { $id = Yii::$app->request->get('id'); $info = GhsClass::getGhsInfo($id); $giveLevel = $info['giveLevel'] ?? 0; $levelMap = CustomClass::$levelMap; $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; util::success($info); } //根据门店获取供应商信息 shish 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; $map = CustomClass::$levelMap; $giveLevel = $ghs['giveLevel'] ?? 0; $ghs['giveLevelName'] = $map[$giveLevel] ?? ''; } else { //没有开店也给显示供应商信息 $shop = ShopClass::getShopInfo($shopId); $shopName = $shop['shopName'] ?? ''; $sjName = $shop['merchantName'] ?? ''; $default = $shop['default'] ?? 0; $name = $default == 1 ? $sjName : $sjName . ' ' . $shopName; $ghs = [ 'id' => 0, 'name' => $name, 'debtAmount' => 0.00, 'expendAmount' => 0.00, 'giveLevel' => 0, 'giveLevelName' => '普通', ]; } util::success($ghs); } //获取客户等级 shish 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) { $map[$key]['num'] = $info[$key . "Num"] ?? 0; $map[$key]['amount'] = $info[$key . "Amount"] ?? 0; } util::success(['list' => $map]); } }