mirror of
https://github.com/crmeb/CRMEB.git
synced 2025-12-16 05:52:51 +00:00
修复后台首页统计无数据js报错bug
This commit is contained in:
parent
2298ae2a96
commit
00cb2627fe
@ -5,6 +5,7 @@ use app\routine\model\store\StoreOrder;
|
|||||||
use app\routine\model\user\RoutineUser;
|
use app\routine\model\user\RoutineUser;
|
||||||
use app\routine\model\user\WechatUser;
|
use app\routine\model\user\WechatUser;
|
||||||
use service\RoutineTemplateService;
|
use service\RoutineTemplateService;
|
||||||
|
use service\ProgramTemplateService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序模板消息
|
* 小程序模板消息
|
||||||
@ -26,7 +27,7 @@ class RoutineTemplate{
|
|||||||
else if($order['pay_type'] == 'offline') $data['keyword4']['value'] = '线下支付';
|
else if($order['pay_type'] == 'offline') $data['keyword4']['value'] = '线下支付';
|
||||||
$data['keyword5']['value'] = '已成功退款';
|
$data['keyword5']['value'] = '已成功退款';
|
||||||
RoutineFormId::delFormIdOne($formId);
|
RoutineFormId::delFormIdOne($formId);
|
||||||
RoutineTemplateService::sendTemplate(WechatUser::getOpenId($order['uid']),RoutineTemplateService::setTemplateId(RoutineTemplateService::ORDER_REFUND_SUCCESS),'',$data,$formId);
|
ProgramTemplateService::sendTemplate(WechatUser::getOpenId($order['uid']),RoutineTemplateService::ORDER_REFUND_SUCCESS,$data, $formId);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 用户申请退款给管理员发送消息
|
* 用户申请退款给管理员发送消息
|
||||||
@ -44,7 +45,7 @@ class RoutineTemplate{
|
|||||||
$formId = RoutineFormId::getFormIdOne($order['uid']);
|
$formId = RoutineFormId::getFormIdOne($order['uid']);
|
||||||
if($formId){
|
if($formId){
|
||||||
RoutineFormId::delFormIdOne($formId);
|
RoutineFormId::delFormIdOne($formId);
|
||||||
RoutineTemplateService::sendTemplate(WechatUser::getOpenId($uid),RoutineTemplateService::setTemplateId(RoutineTemplateService::ORDER_REFUND_STATUS),'',$data,$formId);
|
ProgramTemplateService::sendTemplate(WechatUser::getOpenId($uid),RoutineTemplateService::ORDER_REFUND_STATUS,$data, $formId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,7 +65,7 @@ class RoutineTemplate{
|
|||||||
$formId = RoutineFormId::getFormIdOne($bargainUserId);
|
$formId = RoutineFormId::getFormIdOne($bargainUserId);
|
||||||
if($formId){
|
if($formId){
|
||||||
$dataFormId['formId'] = $formId;
|
$dataFormId['formId'] = $formId;
|
||||||
RoutineTemplateService::sendTemplate(WechatUser::getOpenId($bargainUser['uid']),RoutineTemplateService::setTemplateId(RoutineTemplateService::BARGAIN_SUCCESS),'',$data,$formId);
|
ProgramTemplateService::sendTemplate(WechatUser::getOpenId($bargainUser['uid']),RoutineTemplateService::BARGAIN_SUCCESS,$data, $formId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -82,9 +83,54 @@ class RoutineTemplate{
|
|||||||
$data['keyword4']['value'] = $order['pay_price'];
|
$data['keyword4']['value'] = $order['pay_price'];
|
||||||
if($order['pay_type'] == 'yue') $data['keyword5']['value'] = '余额支付';
|
if($order['pay_type'] == 'yue') $data['keyword5']['value'] = '余额支付';
|
||||||
else if($order['pay_type'] == 'weixin') $data['keyword5']['value'] = '微信支付';
|
else if($order['pay_type'] == 'weixin') $data['keyword5']['value'] = '微信支付';
|
||||||
// else if($order['pay_type'] == 'offline') $data['keyword5']['value'] = '线下支付';
|
else if($order['pay_type'] == 'offline') $data['keyword5']['value'] = '线下支付';
|
||||||
RoutineFormId::delFormIdOne($formId);
|
RoutineFormId::delFormIdOne($formId);
|
||||||
RoutineTemplateService::sendTemplate(WechatUser::getOpenId($order['uid']),RoutineTemplateService::setTemplateId(RoutineTemplateService::ORDER_PAY_SUCCESS),'',$data,$formId);
|
$link = 'pages/orders-con/orders-con?uid='.$order['uid'].'&order_id='.$orderId;
|
||||||
|
ProgramTemplateService::sendTemplate(WechatUser::getOpenId($order['uid']),RoutineTemplateService::ORDER_PAY_SUCCESS,$data, $formId,$link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 订单发货模版消息
|
||||||
|
* @param $order
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function sendOrderPostage($order){
|
||||||
|
$routine_openid = WechatUser::getOpenId($order['uid']);
|
||||||
|
if(!$routine_openid) return true;
|
||||||
|
$tempdata = [
|
||||||
|
'keyword1' => $order['order_id'],
|
||||||
|
'keyword2' => $order['delivery_name'],
|
||||||
|
'keyword3' => $order['delivery_id'],
|
||||||
|
'keyword4' => date('Y-m-d H:i:s',time()),
|
||||||
|
'keyword5' => '您的商品已经发货请注意查收',
|
||||||
|
];
|
||||||
|
$formId = RoutineFormId::getFormIdOne($order['uid']);
|
||||||
|
if($formId){
|
||||||
|
RoutineFormId::delFormIdOne($formId);
|
||||||
|
$link = 'pages/orders-con/orders-con?uid='.$order['uid'].'&order_id='.$order['order_id'];
|
||||||
|
ProgramTemplateService::sendTemplate($routine_openid,RoutineTemplateService::ORDER_POSTAGE_SUCCESS,$tempdata, $formId, $link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/** 订单送货模版消息
|
||||||
|
* @param $order
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function sendOrderDelivery($order){
|
||||||
|
$routine_openid = WechatUser::getOpenId($order['uid']);
|
||||||
|
if(!$routine_openid) return true;
|
||||||
|
$tempdata = [
|
||||||
|
'keyword1' => $order['order_id'],
|
||||||
|
'keyword2' => $order['delivery_name'],
|
||||||
|
'keyword3' => $order['delivery_id'],
|
||||||
|
'keyword4' => date('Y-m-d H:i:s',time()),
|
||||||
|
'keyword5' => '您的商品已经在配送请注意查收',
|
||||||
|
];
|
||||||
|
$formId = RoutineFormId::getFormIdOne($order['uid']);
|
||||||
|
if($formId){
|
||||||
|
RoutineFormId::delFormIdOne($formId);
|
||||||
|
$link = 'pages/orders-con/orders-con?uid='.$order['uid'].'&order_id='.$order['order_id'];
|
||||||
|
ProgramTemplateService::sendTemplate($routine_openid,RoutineTemplateService::ORDER_DELIVER_SUCCESS,$tempdata, $formId, $link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -7,14 +7,16 @@
|
|||||||
|
|
||||||
namespace behavior\admin;
|
namespace behavior\admin;
|
||||||
|
|
||||||
|
use app\admin\model\routine\RoutineFormId;
|
||||||
|
use basic\ModelBasic;
|
||||||
use app\admin\model\user\User;
|
use app\admin\model\user\User;
|
||||||
|
use app\admin\model\order\StoreOrder as AdminStoreOrder;
|
||||||
use app\admin\model\user\UserAddress;
|
use app\admin\model\user\UserAddress;
|
||||||
use app\admin\model\user\UserBill;
|
use app\admin\model\user\UserBill;
|
||||||
use app\admin\model\wechat\WechatUser;
|
use app\admin\model\wechat\WechatUser;
|
||||||
use basic\ModelBasic;
|
|
||||||
use app\admin\model\order\StoreOrder;
|
|
||||||
use service\SystemConfigService;
|
use service\SystemConfigService;
|
||||||
use service\WechatTemplateService;
|
use service\WechatTemplateService;
|
||||||
|
use service\RoutineTemplateService;
|
||||||
|
|
||||||
class OrderBehavior
|
class OrderBehavior
|
||||||
{
|
{
|
||||||
@ -29,8 +31,8 @@ class OrderBehavior
|
|||||||
* $oid string store_order表中的id
|
* $oid string store_order表中的id
|
||||||
*/
|
*/
|
||||||
public static function storeProductOrderDeliveryAfter($data,$oid){
|
public static function storeProductOrderDeliveryAfter($data,$oid){
|
||||||
StoreOrder::orderPostageAfter($oid,$data);
|
AdminStoreOrder::orderPostageAfter($oid,$data);
|
||||||
StoreOrder::sendOrderGoods($oid,$data);
|
// AdminStoreOrder::sendOrderGoods($oid,$data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,8 +43,24 @@ class OrderBehavior
|
|||||||
* $oid string store_order表中的id
|
* $oid string store_order表中的id
|
||||||
*/
|
*/
|
||||||
public static function storeProductOrderDeliveryGoodsAfter($data,$oid){
|
public static function storeProductOrderDeliveryGoodsAfter($data,$oid){
|
||||||
StoreOrder::orderPostageAfter($oid,$data);
|
AdminStoreOrder::orderPostageAfter($oid,$data);
|
||||||
StoreOrder::sendOrderGoods($oid,$data);
|
// AdminStoreOrder::sendOrderGoods($oid,$data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 后台修改状态 为已收货
|
||||||
|
* @param $data
|
||||||
|
* $data array status 状态为 已收货
|
||||||
|
* @param $oid
|
||||||
|
* $oid string store_order表中的id
|
||||||
|
*/
|
||||||
|
public static function storeProductOrderTakeDelivery($order)
|
||||||
|
{
|
||||||
|
|
||||||
|
$res1 = AdminStoreOrder::gainUserIntegral($order);
|
||||||
|
$res2 = User::backOrderBrokerage($order);
|
||||||
|
AdminStoreOrder::orderTakeAfter($order);
|
||||||
|
if(!($res1 && $res2)) exception('收货失败!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -54,7 +72,8 @@ class OrderBehavior
|
|||||||
* $oid string store_order表中的id
|
* $oid string store_order表中的id
|
||||||
*/
|
*/
|
||||||
public static function storeProductOrderRefundYAfter($data,$oid){
|
public static function storeProductOrderRefundYAfter($data,$oid){
|
||||||
StoreOrder::refundTemplate($data,$oid);
|
if($data['is_channel']) AdminStoreOrder::refundRoutineTemplate($oid); //TODO 小程序余额退款模板消息
|
||||||
|
else AdminStoreOrder::refundTemplate($data,$oid);//TODO 公众号余额退款模板消息
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -104,7 +123,7 @@ class OrderBehavior
|
|||||||
*/
|
*/
|
||||||
public static function storeProductOrderApplyRefundAfter($oid, $uid)
|
public static function storeProductOrderApplyRefundAfter($oid, $uid)
|
||||||
{
|
{
|
||||||
$order = StoreOrder::where('id',$oid)->find();
|
$order = AdminStoreOrder::where('id',$oid)->find();
|
||||||
WechatTemplateService::sendAdminNoticeTemplate([
|
WechatTemplateService::sendAdminNoticeTemplate([
|
||||||
'first'=>"亲,您有一个订单申请退款 \n订单号:{$order['order_id']}",
|
'first'=>"亲,您有一个订单申请退款 \n订单号:{$order['order_id']}",
|
||||||
'keyword1'=>'申请退款',
|
'keyword1'=>'申请退款',
|
||||||
@ -137,6 +156,18 @@ class OrderBehavior
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO 后台余额退款
|
||||||
|
* @param $product
|
||||||
|
* @param $refund_data
|
||||||
|
*/
|
||||||
|
public static function storeOrderYueRefund($product,$refund_data)
|
||||||
|
{
|
||||||
|
$res = AdminStoreOrder::integralBack($product['id']);
|
||||||
|
if(!$res) exception('退积分失败!');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user