|
|
@@ -3,23 +3,20 @@
|
|
|
namespace biz\message\services;
|
|
|
|
|
|
use biz\admin\classes\AdminClass;
|
|
|
-use biz\admin\services\AdminService;
|
|
|
use biz\base\services\BaseService;
|
|
|
use biz\merchant\services\MerchantService;
|
|
|
use biz\message\classes\InformAdminClass;
|
|
|
use common\components\sms;
|
|
|
-use common\components\util;
|
|
|
use common\components\weixinUtil;
|
|
|
use common\services\xhTMessageService;
|
|
|
use Yii;
|
|
|
-use linslin\yii2\curl;
|
|
|
|
|
|
class InformAdminService extends BaseService
|
|
|
{
|
|
|
|
|
|
public static $baseFile = '\biz\message\classes\InformAdminClass';
|
|
|
|
|
|
- //通知
|
|
|
+ //通知到员工 shish 2020.1.1
|
|
|
public static function inform($merchantId, $type, $params)
|
|
|
{
|
|
|
$adminList = AdminClass::getAllNoticeAdmin($merchantId);
|
|
|
@@ -30,78 +27,16 @@ class InformAdminService extends BaseService
|
|
|
$merchant = MerchantService::getById($merchantId);
|
|
|
foreach ($adminList as $adminKey => $admin) {
|
|
|
$openId = $admin['openId'];
|
|
|
+ $informWay = !empty($openId) && $admin['subscribe'] == 1 ? 'wx' : 'sms';
|
|
|
+ $sendData = InformAdminClass::inform($params, $type, $informWay, $TMList);
|
|
|
if (!empty($openId) && $admin['subscribe'] == 1) {
|
|
|
- $tmData = InformAdminClass::inform($params, $type, 0, $TMList);
|
|
|
- $respond = weixinUtil::sendTaskInform($tmData, $merchant);
|
|
|
+ $respond = weixinUtil::sendTaskInform($sendData, $merchant);
|
|
|
Yii::info('tm:' . json_encode($respond));
|
|
|
} else {
|
|
|
$mobile = $admin['mobile'];
|
|
|
- $msg = InformAdminClass::inform($params, $type, 1);
|
|
|
- sms::merchantSend($mobile, $msg, $merchant);
|
|
|
+ sms::merchantSend($mobile, $sendData, $merchant);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- //门店收入提醒 shish 2019.12.24
|
|
|
- public static function shopIncomeInformAdmin($data, $merchantId = 0)
|
|
|
- {
|
|
|
- $TMList = xhTMessageService::getList($merchantId);
|
|
|
- $adminList = AdminClass::getAllNoticeAdmin($merchantId);
|
|
|
- $merchant = MerchantService::getById($merchantId);
|
|
|
- $shortTempId = 'OPENTM207422813';//收入提醒
|
|
|
- if (isset($TMList[$shortTempId]) == false) {
|
|
|
- util::fail('没有找到公众号的消息模样:' . $shortTempId);
|
|
|
- }
|
|
|
- $tempId = $TMList[$shortTempId];
|
|
|
- foreach ($adminList as $adminKey => $admin) {
|
|
|
- $openId = $admin['openId'];
|
|
|
- if (!empty($openId) && $admin['subscribe'] == 1) {
|
|
|
- $data = ["touser" => $openId, "template_id" => $tempId,
|
|
|
- "url" => Yii::$app->params['adminUrl'] . '/order/detail?id=' . $orderId, "data" => [
|
|
|
- "first" => ["value" => $userName . $payWay . '付款', "color" => "#173177"],
|
|
|
- "keyword1" => ["value" => $totalFee . '元', "color" => "#173177"],
|
|
|
- "keyword2" => ["value" => '客户付款', "color" => "#173177"],
|
|
|
- "keyword3" => ["value" => date("Y-m-d H:i"), "color" => "#173177"],
|
|
|
- "remark" => ["value" => "点击查看明细", "color" => "#173177"]]];
|
|
|
- $respond = weixinUtil::sendTaskInform($data, $merchant);
|
|
|
- Yii::info('tm:' . json_encode($respond));
|
|
|
- } else {
|
|
|
- $mobile = $admin['mobile'];
|
|
|
- $msg = "客户" . $userName . "付款" . $totalFee . '元';
|
|
|
- sms::merchantSend($mobile, $msg, $merchant);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //宝贝售出通知 shish 2019.12.24
|
|
|
- public static function goodsSoldInformAdmin($merchantId)
|
|
|
- {
|
|
|
-
|
|
|
- $TMList = xhTMessageService::getList($merchantId);
|
|
|
- $merchant = MerchantService::getById($merchantId);
|
|
|
- $shortTempId = 'OPENTM207422813';//收入提醒
|
|
|
- $tempId = isset($TMList[$shortTempId]) ? $TMList[$shortTempId] : '';
|
|
|
- foreach ($adminList as $adminKey => $admin) {
|
|
|
- $openId = $admin['openId'];
|
|
|
- if (!empty($openId) && $admin['subscribe'] == 1) {
|
|
|
- $tmData = ["touser" => $openId, "template_id" => $tempId, "url" => Yii::$app->params['adminUrl'] . '/order/detail?id=' . $orderId, "data" => [
|
|
|
- "first" => ["value" => '您有宝贝售出哦!', "color" => "#173177"],
|
|
|
- "keyword1" => ["value" => (string)$orderId, "color" => "#173177"],
|
|
|
- "keyword2" => ["value" => $orderName, "color" => "#173177"],
|
|
|
- "keyword3" => ["value" => number_format($totalFee, 2) . '元', "color" => "#173177"],
|
|
|
- "keyword4" => ["value" => number_format($totalFee, 2) . '元', "color" => "#173177"],
|
|
|
- "keyword5" => ["value" => $userName, "color" => "#173177"],
|
|
|
- "remark" => ["value" => '点此查看详细、编辑收花人信息。', "color" => "#173177"]]];
|
|
|
- $respond = weixinUtil::sendTaskInform($tmData, $merchant);
|
|
|
- Yii::info('tm:' . json_encode($respond));
|
|
|
- } else {
|
|
|
- $mobile = $admin['mobile'];
|
|
|
- $msg = "客户" . $userName . "付款" . $totalFee . '元';
|
|
|
- sms::merchantSend($mobile, $msg, $merchant);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
|
|
|
}
|