|
|
@@ -0,0 +1,61 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace bizHd\notice\classes;
|
|
|
+
|
|
|
+use biz\base\classes\BaseClass;
|
|
|
+use bizHd\admin\classes\AdminClass;
|
|
|
+use bizHd\staff\classes\StaffClass;
|
|
|
+use bizHd\wx\classes\WxOpenClass;
|
|
|
+use common\components\dict;
|
|
|
+use common\components\miniUtil;
|
|
|
+use Yii;
|
|
|
+
|
|
|
+class NoticeClass extends BaseClass
|
|
|
+{
|
|
|
+
|
|
|
+ //采购成功之后小程序通知
|
|
|
+ public static function cgSuccessMiniNotice($cgShop, $cg)
|
|
|
+ {
|
|
|
+ $mainId = $cgShop->mainId ?? 0;
|
|
|
+ $staffList = StaffClass::getAllByCondition(['mainId' => $mainId], null, 'adminId');
|
|
|
+
|
|
|
+ $merchant = WxOpenClass::getWxInfo();
|
|
|
+ $ptStyle = dict::getDict('ptStyle', 'hd');
|
|
|
+ if (getenv('YII_ENV') == 'production') {
|
|
|
+ $msgList = dict::getDict('hdMiniMessage');
|
|
|
+ } else {
|
|
|
+ $msgList = dict::getDict('hdMiniMessageDev');
|
|
|
+ }
|
|
|
+ $msgId = $msgList['cgSuccess']['msgId'] ?? '';
|
|
|
+ if (empty($msgId)) {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ $ghsName = $cg->ghsName ?? '';
|
|
|
+ $bigNum = $cg->bigNum ?? 0;
|
|
|
+ $actPrice = $cg->actPrice ? floatval($cg->actPrice) : 0;
|
|
|
+ $payTime = $cg->payTime ?? '';
|
|
|
+ if (!empty($staffList)) {
|
|
|
+ $ids = array_column($staffList, 'adminId');
|
|
|
+ if (!empty($ids)) {
|
|
|
+ $adminList = AdminClass::getByIds($ids);
|
|
|
+ if (!empty($adminList)) {
|
|
|
+ foreach ($adminList as $admin) {
|
|
|
+ $miniOpenId = $admin['miniOpenId'] ?? '';
|
|
|
+ if (!empty($miniOpenId)) {
|
|
|
+ $msg = [
|
|
|
+ "thing1" => ["value" => $ghsName],
|
|
|
+ "thing2" => ["value" => $bigNum . "扎花材"],
|
|
|
+ "amount3" => ["value" => $actPrice],
|
|
|
+ "date4" => ["value" => $payTime],
|
|
|
+ "thing5" => ["value" => "点击查看详情"]
|
|
|
+ ];
|
|
|
+ $page = 'pagesPurchase/purDetails?id=' . $cg->id;
|
|
|
+ miniUtil::commonSendSubscribeMessage($merchant, $ptStyle, $msgId, $miniOpenId, $page, $msg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|