InformAdminClass.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. namespace biz\message\classes;
  3. use Yii;
  4. use biz\base\classes\BaseClass;
  5. class InformAdminClass extends BaseClass
  6. {
  7. public static $baseFile = '\biz\message\models\InformAdmin';
  8. //宝贝售出通知 shish 2019.12.24
  9. public static function goodsSoldInformAdmin($params, $informWay = 0, $TMList = [])
  10. {
  11. $params = [];
  12. if ($informWay == 'wx') {
  13. //收入提醒
  14. $shortTempId = 'OPENTM207422813';
  15. $tempId = isset($TMList[$shortTempId]) ? $TMList[$shortTempId] : '';
  16. $tmData = ["touser" => $openId, "template_id" => $tempId, "url" => Yii::$app->params['adminUrl'] . '/order/detail?id=' . $orderId, "data" => [
  17. "first" => ["value" => '您有宝贝售出哦!', "color" => "#173177"],
  18. "keyword1" => ["value" => (string)$orderId, "color" => "#173177"],
  19. "keyword2" => ["value" => $orderName, "color" => "#173177"],
  20. "keyword3" => ["value" => number_format($totalFee, 2) . '元', "color" => "#173177"],
  21. "keyword4" => ["value" => number_format($totalFee, 2) . '元', "color" => "#173177"],
  22. "keyword5" => ["value" => $userName, "color" => "#173177"],
  23. "remark" => ["value" => '点此查看详细、编辑收花人信息。', "color" => "#173177"]]];
  24. return $tmData;
  25. }
  26. if ($informWay == 'sms') {
  27. return "客户" . $userName . "付款" . $totalFee . '元';
  28. }
  29. }
  30. //宝贝售出通知 shish 2019.12.24
  31. public static function inform($params, $type, $informWay = 0, $TMList = [])
  32. {
  33. switch ($type) {
  34. case 'goodsSoldInformAdmin':
  35. $respond = self::goodsSoldInformAdmin($params, $informWay, $TMList);
  36. break;
  37. default:
  38. }
  39. return $respond;
  40. }
  41. //门店收入提醒 shish 2019.12.24
  42. public static function shopIncomeInformAdmin2($data, $merchantId = 0)
  43. {
  44. $TMList = xhTMessageService::getList($merchantId);
  45. $adminList = AdminClass::getAllNoticeAdmin($merchantId);
  46. $merchant = MerchantService::getById($merchantId);
  47. $shortTempId = 'OPENTM207422813';//收入提醒
  48. if (isset($TMList[$shortTempId]) == false) {
  49. util::fail('没有找到公众号的消息模样:' . $shortTempId);
  50. }
  51. $tempId = $TMList[$shortTempId];
  52. foreach ($adminList as $adminKey => $admin) {
  53. $openId = $admin['openId'];
  54. if (!empty($openId) && $admin['subscribe'] == 1) {
  55. $data = ["touser" => $openId, "template_id" => $tempId,
  56. "url" => Yii::$app->params['adminUrl'] . '/order/detail?id=' . $orderId, "data" => [
  57. "first" => ["value" => $userName . $payWay . '付款', "color" => "#173177"],
  58. "keyword1" => ["value" => $totalFee . '元', "color" => "#173177"],
  59. "keyword2" => ["value" => '客户付款', "color" => "#173177"],
  60. "keyword3" => ["value" => date("Y-m-d H:i"), "color" => "#173177"],
  61. "remark" => ["value" => "点击查看明细", "color" => "#173177"]]];
  62. $respond = weixinUtil::sendTaskInform($data, $merchant);
  63. Yii::info('tm:' . json_encode($respond));
  64. } else {
  65. $mobile = $admin['mobile'];
  66. $msg = "客户" . $userName . "付款" . $totalFee . '元';
  67. sms::merchantSend($mobile, $msg, $merchant);
  68. }
  69. }
  70. }
  71. //宝贝售出通知 shish 2019.12.24
  72. public static function goodsSoldInformAdmin2($merchantId)
  73. {
  74. $TMList = xhTMessageService::getList($merchantId);
  75. $merchant = MerchantService::getById($merchantId);
  76. $shortTempId = 'OPENTM207422813';//收入提醒
  77. $tempId = isset($TMList[$shortTempId]) ? $TMList[$shortTempId] : '';
  78. foreach ($adminList as $adminKey => $admin) {
  79. $openId = $admin['openId'];
  80. if (!empty($openId) && $admin['subscribe'] == 1) {
  81. $sendData = ["touser" => $openId, "template_id" => $tempId, "url" => Yii::$app->params['adminUrl'] . '/order/detail?id=' . $orderId, "data" => [
  82. "first" => ["value" => '您有宝贝售出哦!', "color" => "#173177"],
  83. "keyword1" => ["value" => (string)$orderId, "color" => "#173177"],
  84. "keyword2" => ["value" => $orderName, "color" => "#173177"],
  85. "keyword3" => ["value" => number_format($totalFee, 2) . '元', "color" => "#173177"],
  86. "keyword4" => ["value" => number_format($totalFee, 2) . '元', "color" => "#173177"],
  87. "keyword5" => ["value" => $userName, "color" => "#173177"],
  88. "remark" => ["value" => '点此查看详细、编辑收花人信息。', "color" => "#173177"]]];
  89. $respond = weixinUtil::sendTaskInform($sendData, $merchant);
  90. Yii::info('tm:' . json_encode($respond));
  91. } else {
  92. $mobile = $admin['mobile'];
  93. $msg = "客户" . $userName . "付款" . $totalFee . '元';
  94. sms::merchantSend($mobile, $msg, $merchant);
  95. }
  96. }
  97. }
  98. }