main; util::success(['info' => $main]); } //商城海报 ssh 20210610 public function actionGetMallPoster() { $shop = $this->shop; $pfShopId = $shop->pfShopId ?? 0; $merchant = WxOpenClass::getMallWxInfo(); $goodsPage = 'pages/home/category'; $ptStyle = dict::getDict('ptStyle', 'mall'); $scene = 'a=' . $this->shopAdminId . '&s=' . $this->shopId; $goodsImgUrl = miniUtil::generateUnlimitedMiniCode($merchant, $goodsPage, $scene, $ptStyle); //miniUtil::generateShortLink($merchant, $ptStyle,'pages/home/recent','花美林'); $flowerPage = 'pages/item/item'; $flowerImgUrl = miniUtil::generateUnlimitedMiniCode($merchant, $flowerPage, $scene, $ptStyle); $prefix = imgUtil::getPrefix(); $titleBase64 = stringUtil::ossBase64('扫码买花'); if ($pfShopId > 0) { $goodsUrl = $prefix . 'shop/miniCodeBg.jpg?x-oss-process=image'; $goodsMiniCodeBase64 = stringUtil::ossBase64($goodsImgUrl); $goodsUrl .= '/watermark,image_' . $goodsMiniCodeBase64 . ',g_north,x_0,y_40'; $goodsUrl .= '/watermark,text_' . $titleBase64 . ',g_north,x_0,y_530,size_50'; $flowerUrl = $prefix . 'shop/miniCodeBg.jpg?x-oss-process=image'; $flowerMiniCodeBase64 = stringUtil::ossBase64($flowerImgUrl); $flowerUrl .= '/watermark,image_' . $flowerMiniCodeBase64 . ',g_north,x_0,y_40'; $flowerUrl .= '/watermark,text_' . $titleBase64 . ',g_north,x_0,y_530,size_50'; $respond = [ 'imgUrl' => $goodsUrl, 'flowerImgUrl' => $flowerUrl, ]; } else { $goodsUrl = imgUtil::groupImg($goodsImgUrl); $flowerUrl = imgUtil::groupImg($flowerImgUrl); $respond = [ 'imgUrl' => $goodsUrl, 'flowerImgUrl' => $flowerUrl, ]; } //零交会 $merchant = WxOpenClass::getWxInfo(); $page = 'admin/ljh/info'; $ptStyle = dict::getDict('ptStyle', 'hd'); $scene = "sw=1"; $imgUrl = miniUtil::generateUnlimitedMiniCode($merchant, $page, $scene, $ptStyle); $apiHost = Yii::$app->params['hdImgHost']; $ljh = $apiHost . $imgUrl; $respond['ljhUrl'] = $ljh; util::success($respond); } //会员注册码 ssh 20220607 public function actionGetMemberPoster() { $merchant = WxOpenClass::getMallWxInfo(); $page = 'pages/login/index'; $ptStyle = dict::getDict('ptStyle', 'mall'); $scene = 'a=' . $this->shopAdminId . '&s=' . $this->shopId; $imgUrl = miniUtil::generateUnlimitedMiniCode($merchant, $page, $scene, $ptStyle); $prefix = imgUtil::getPrefix(); $titleBase64 = stringUtil::ossBase64('扫码注册'); $memberUrl = $prefix . 'shop/miniCodeBg.jpg?x-oss-process=image'; $memberMiniCodeBase64 = stringUtil::ossBase64($imgUrl); $memberUrl .= '/watermark,image_' . $memberMiniCodeBase64 . ',g_north,x_0,y_40'; $memberUrl .= '/watermark,text_' . $titleBase64 . ',g_north,x_0,y_530,size_50'; $respond = ['imgUrl' => $memberUrl]; util::success($respond); } public function actionDemo() { return $this->renderPartial('demo'); } //新客户 ssh 2019.12.29 public function actionVisit() { $data = json_encode(array( 'type' => 'msg', 'msg' => 'aaaa', )); $id = 'merchantConsole_' . $this->sjId; $online = Gateway::getClientIdByUid($id); if ($online) { //直接发送 Gateway::sendToUid($id, json_encode($data)); } else { //保存 } } //新订单 ssh 2019.12.29 public function actionOrder() { $data = json_encode(array( 'type' => 'msg', 'msg' => 'aaaa', )); $id = 'merchantConsole_' . $this->sjId; $online = Gateway::getClientIdByUid($id); if ($online) { //直接发送 Gateway::sendToUid($id, json_encode($data)); } else { //保存 } } //我的 ssh 2021.4.8 public function actionMy() { $lookMoney = \bizGhs\shop\classes\ShopAdminClass::lookMoneyPower($this->shopAdmin, $this->shop); $shop = $this->shop; $main = $this->main; $mainId = $main->id ?? 0; $balance = $main->balance ?? 0.00; $money = $main->money ?? 0; $txBalance = $main->txBalance ?? 0.00; $sj = isset($this->sj) && !empty($this->sj) ? $this->sj->attributes : []; $shopImg = Yii::$app->params['hdImgHost'] . 'retail/default-img.png'; if (isset($shop->avatar) && !empty($shop->avatar)) { $shopImg = Yii::$app->params['ghsImgHost'] . $shop->avatar; } $deadline = $sj['deadline'] ?? ''; $relation = isset($this->shopAdmin) && !empty($this->shopAdmin) ? $this->shopAdmin->attributes : []; $adminName = $relation['name'] ?? ''; $eId = $relation['id'] ?? 0; $mobile = $relation['mobile'] ?? ''; $sjName = $sj['name'] ?? ''; $shopName = $shop->shopName ?? ''; $cashAccount = $main->cashAccount ?? ''; $data = [ 'balance' => $balance, 'txBalance' => $txBalance, 'shopImg' => $shopImg, 'deadline' => $deadline, 'adminName' => $adminName, 'adminMobile' => $mobile, 'sjName' => $sjName, 'shopName' => $shopName, 'shopImg' => $shopImg, 'cashAccount' => $cashAccount, 'shopAdminId' => $eId, 'shopId' => $this->shopId, 'sjId' => $this->sjId, 'money' => $money, 'mainId' => $mainId, 'lookMoney' => $lookMoney, ]; util::success($data); } //经营概况 ssh 2021.1.27 public function actionProfile() { //余额 $shopInfo = ShopClass::getById($this->shopId); //库存情况 $stockInfo = ProductClass::getProductStockByShopId($this->sjId, $this->shopId); //今日销售金额 $today = StatIncomeClass::getAmountToday($this->shopId); //近七天销售金额 $latestSeven = StatIncomeClass::getAmountWeek($this->shopId); //30天销售金额 $latestThirty = StatIncomeClass::getAmountThirty($this->shopId); $base = [ 'balance' => $shopInfo['balance'], 'mayGathering' => $shopInfo['mayGathering'] ?? 0.00, 'mayPay' => $shopInfo['mayPay'] ?? 0.00, 'stockCost' => $stockInfo['stockCost'], 'stockNum' => 0, 'stockBigNum' => $stockInfo['stockBigNum'], 'stockSmallNum' => $stockInfo['stockSmallNum'], 'stockWarning' => $stockInfo['stockWarning'], 'today' => $today, 'todayCompareYesterday' => 0, 'latestSeven' => $latestSeven, 'latestSevenSameTerm' => 0, 'latestThirty' => $latestThirty, 'latestThirtySameTerm' => 0, ]; //今日订单数 $saleNum = StatOrderClass::getRiseNumToday($this->shopId); //今日销售金额 $saleAmount = $today; //昨日订单数 $ySaleNum = StatOrderClass::getRiseNumYesterday($this->shopId); //昨日销售金额 $ySaleAmount = StatIncomeClass::getAmountYesterday($this->shopId); //7天订单数 $sevenSaleNum = StatOrderClass::getRiseNumWeek($this->shopId); //7天销售金额 $sevenSaleAmount = $latestSeven; //30天订单数 $thirtySaleNum = StatOrderClass::getRiseNumThirty($this->shopId); //30天销售金额 $thirtySaleAmount = $latestThirty; //今日采购 $todayCg = StatCgClass::getTodayCg($this->shop); //昨日采购 $yesCg = StatCgClass::getYesterdayCg($this->shop); //7日采购 $sevenCg = StatCgClass::getSevenCg($this->shop); //30日采购 $thirtyCg = StatCgClass::getThirtyCg($this->shop); $more = [ 'today' => [ 'income' => 0, 'expend' => 0, 'saleNum' => $saleNum, 'saleAmount' => $saleAmount, 'purchaseNum' => $todayCg['num'] ?? 0, 'purchaseAmount' => $todayCg['amount'] ?? 0.00, ], 'yesterday' => [ 'income' => 0, 'expend' => 0, 'saleNum' => $ySaleNum, 'saleAmount' => $ySaleAmount, 'purchaseNum' => $yesCg['num'] ?? 0, 'purchaseAmount' => $yesCg['amount'] ?? 0.00, ], 'latestSeven' => [ 'income' => 0, 'expend' => 0, 'saleNum' => $sevenSaleNum, 'saleAmount' => $sevenSaleAmount, 'purchaseNum' => $sevenCg['num'] ?? 0, 'purchaseAmount' => $sevenCg['amount'] ?? 0.00, ], 'latestThirty' => [ 'income' => 0, 'expend' => 0, 'saleNum' => $thirtySaleNum, 'saleAmount' => $thirtySaleAmount, 'purchaseNum' => $thirtyCg['num'] ?? 0, 'purchaseAmount' => $thirtyCg['amount'] ?? 0.00, ], ]; util::success(['base' => $base, 'more' => $more]); } }