|
|
@@ -13,6 +13,51 @@ use Yii;
|
|
|
class NoticeClass extends BaseClass
|
|
|
{
|
|
|
|
|
|
+ //有新的结账单 ssh 20230514
|
|
|
+ public static function newClearNotice($shop, $clear)
|
|
|
+ {
|
|
|
+ $result = [];
|
|
|
+ $mainId = $shop->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['remindHdClear']['msgId'] ?? '';
|
|
|
+ if (empty($msgId)) {
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
+ $num = $clear->num ?? 0;
|
|
|
+ $actPrice = $clear->actPrice ?? 0;
|
|
|
+ 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 = [
|
|
|
+ "amount3" => ["value" => $actPrice],
|
|
|
+ "short_thing2" => ["value" => $num . "笔"],
|
|
|
+ "time1" => ["value" => "2023年新年"],
|
|
|
+ ];
|
|
|
+ $page = 'admin/clear/info?id=' . $clear->id;
|
|
|
+ $respond = miniUtil::commonSendSubscribeMessage($merchant, $ptStyle, $msgId, $miniOpenId, $page, $msg);
|
|
|
+ if (isset($respond['errcode']) && $respond['errcode'] === 0) {
|
|
|
+ $result['hasNotice'] = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
+
|
|
|
//采购成功之后小程序通知
|
|
|
public static function cgSuccessMiniNotice($cgShop, $cg)
|
|
|
{
|