|
|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace common\services;
|
|
|
|
|
|
+use biz\MQ\services\InformAdminService;
|
|
|
use biz\stat\services\StatIncomeCategoryService;
|
|
|
use biz\stat\services\StatIncomeSourceService;
|
|
|
use Yii;
|
|
|
@@ -58,7 +59,8 @@ class xhMerchantAssetService
|
|
|
Yii::$app->redis->executeCommand('DEL', [$key]);
|
|
|
return self::getByMerchantId($merchantId);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ //收入后资产变更 shish 2019.12.24
|
|
|
public static function incomeChangeAsset($merchant, $merchantAsset, $updateData, $order, $capitalType)
|
|
|
{
|
|
|
$merchantId = $merchant['id'];
|
|
|
@@ -66,23 +68,6 @@ class xhMerchantAssetService
|
|
|
$openMerchantId = $openMerchant['id'];
|
|
|
$orderId = $order['id'];
|
|
|
$date = date("Y-m-d H:i");
|
|
|
- $allTM = xhTMessageService::getList($merchantId);
|
|
|
-
|
|
|
- //商家收益通知人暂时写死掉
|
|
|
- $adminOpenIdArr = [
|
|
|
- //国兰
|
|
|
- 'wx193341a4a80f6ea3' => ['o4c8Vs54PQh32nkgG8R3m4VuGTvw', 'o4c8VszacQJyrzu651CAu0sCsfPc'],
|
|
|
- //花美灵
|
|
|
- 'wx84d95afcb7b594eb' => ['oTFbYvsjwgVwXggwtlM2ESAKwuN8', 'oTFbYvqP6qwdCCkdFB9GYnlzDIUg'],
|
|
|
- //花卉宝
|
|
|
- 'wx66dd83ff8744f7a8' => ['o1ka30xHBAK2rSmfezJEv9-V3tIQ'],
|
|
|
- //雨非轩老店
|
|
|
- 'wxdb97a39f719f38f9' => ['oTezys9qZSZZyUeL-c1ZzoYP1GFU'],
|
|
|
- //雨非轩新店
|
|
|
- 'wx6fe0ae87d6051e7b' => ['oeJ5puPaiBz_-ZPeYmhxXyY0K9tU'],
|
|
|
- ];
|
|
|
- $adminOpenIdList = $adminOpenIdArr[$merchant['wxAppId']];
|
|
|
-
|
|
|
$totalFee = 0;
|
|
|
$payWayList = configDict::getConfig('payWayName');
|
|
|
$payWay = isset($order['payWay']) ? $order['payWay'] : 0;
|
|
|
@@ -90,13 +75,12 @@ class xhMerchantAssetService
|
|
|
$userId = isset($order['userId']) ? $order['userId'] : 0;
|
|
|
$user = xhUserService::getById($userId);
|
|
|
$userName = isset($user['userName']) ? $user['userName'] : '游客';
|
|
|
-
|
|
|
- Yii::info('capitaltype:' . $capitalType);
|
|
|
-
|
|
|
- $typeList = configDict::getConfig('capitalType');//充值支付涉及的流水类型列表
|
|
|
- switch ($capitalType) {//根据流水类型定制通知内容
|
|
|
-
|
|
|
- case $typeList['xhOrder']['id']://购买商品
|
|
|
+ //充值支付涉及的流水类型列表
|
|
|
+ $typeList = configDict::getConfig('capitalType');
|
|
|
+ //根据流水类型定制通知内容
|
|
|
+ switch ($capitalType) {
|
|
|
+ //购买商品
|
|
|
+ case $typeList['xhOrder']['id']:
|
|
|
$orderName = $order['bookName'];
|
|
|
$totalFee = $order['actPrice'];
|
|
|
$goodsList = xhOrderGoodsService::getAllByOrderId($orderId);
|
|
|
@@ -110,55 +94,27 @@ class xhMerchantAssetService
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //商城下单后通知
|
|
|
if ($order['sourceType'] == 0) {
|
|
|
- $shortTempId = 'OPENTM207327227';//宝贝售出提醒
|
|
|
- $tempId = $allTM[$shortTempId];
|
|
|
- if (isset($allTM[$shortTempId])) {
|
|
|
- if (!empty($adminOpenIdList)) {
|
|
|
- foreach ($adminOpenIdList as $adminOpenId) {
|
|
|
- $tmData = ["touser" => $adminOpenId, "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"]]];
|
|
|
- $r = weixinUtil::sendTaskInform($tmData, $merchant);
|
|
|
- Yii::info('tm:' . json_encode($r));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ //InformAdminService::goodsSoldInformAdmin($data);
|
|
|
+ //门店收入后通知
|
|
|
} else {
|
|
|
-
|
|
|
- $shortTempId = 'OPENTM207422813';//收入提醒
|
|
|
- if (isset($allTM[$shortTempId])) {
|
|
|
- $tempId = $allTM[$shortTempId];
|
|
|
- if (!empty($adminOpenIdList)) {
|
|
|
- foreach ($adminOpenIdList as $adminOpenId) {
|
|
|
- $data = ["touser" => $adminOpenId, "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"]]];
|
|
|
- $r = weixinUtil::sendTaskInform($data, $merchant);
|
|
|
- Yii::info('tm:' . json_encode($r));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+ //InformAdminService::shopIncomeInformAdmin($data);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
$asset = self::updateByMerchantId($merchantId, $updateData);
|
|
|
- Yii::info('totalfee:' . $totalFee);
|
|
|
- if ($totalFee > 0) {//以下一定要排后面,否则数据不准确
|
|
|
+ //以下一定要排后面,否则数据不准确
|
|
|
+ if ($totalFee > 0) {
|
|
|
xhStatIncomeService::replace($merchantId, $totalFee, $order['payWay']);
|
|
|
xhStatIncomeMonthService::replace($merchantId, $totalFee, $order['payWay']);
|
|
|
/**收入来源资金增加**/
|
|
|
- StatIncomeSourceService::replaceData(['merchantId' => $order['merchantId'], 'sourceType' => $order['sourceType'], 'amount' => $order['actPrice'], 'payWay' => $order['payWay']]);
|
|
|
+ StatIncomeSourceService::replaceData([
|
|
|
+ 'merchantId' => $order['merchantId'],
|
|
|
+ 'sourceType' => $order['sourceType'],
|
|
|
+ 'amount' => $order['actPrice'],
|
|
|
+ 'payWay' => $order['payWay']
|
|
|
+ ]);
|
|
|
}
|
|
|
}
|
|
|
|