Merge pull request 'dev' (#65) from dev into main

Reviewed-on: #65
This commit is contained in:
mkm 2024-07-29 17:40:54 +08:00
commit d038bac5f4
15 changed files with 145 additions and 104 deletions

View File

@ -116,40 +116,7 @@ class StoreOrderController extends BaseAdminController
if(empty($detail)){ if(empty($detail)){
return $this->fail('无该订单请检查'); return $this->fail('无该订单请检查');
} }
//微信支付 StoreOrderLogic::refund($detail,$params);
if(in_array($detail['pay_type'],[PayEnum::WECHAT_PAY_MINI,PayEnum::WECHAT_PAY_BARCODE])){
$money = (int)bcmul($detail['pay_price'],100);
$refund = (new \app\common\logic\store_order\StoreOrderLogic())
->refund($params['order_id'],$money,$money);
if($refund){
// $arr = [
// 'amount'=>[
// 'refund'=>$money
// ]
// ];
// PayNotifyLogic::refund($params['order_id'],$arr);
return $this->success();
}
}
//余额支付 采购款支付
if (in_array($detail['pay_type'] ,[PayEnum::BALANCE_PAY,PayEnum::PURCHASE_FUNDS])){
$money = bcmul($detail['pay_price'],100);
$arr = [
'amount'=>[
'refund'=>$money
]
];
PayNotifyLogic::refund($params['order_id'],$arr);
return $this->success();
}
//现金支付
if($detail['pay_type'] = PayEnum::CASH_PAY){
PayNotifyLogic::cash_refund($params['order_id']);
return $this->success();
}
//todo 支付包支付
return $this->fail('退款失败'); return $this->fail('退款失败');
} }

View File

@ -64,7 +64,11 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface
->order(['id' => 'desc']) ->order(['id' => 'desc'])
->select()->each(function ($item) { ->select()->each(function ($item) {
$item['pay_time'] = $item['pay_time'] > 0 ? date('Y-m-d H:i:s', $item['pay_time']) : ''; $item['pay_time'] = $item['pay_time'] > 0 ? date('Y-m-d H:i:s', $item['pay_time']) : '';
if($item['status']==-1){
$item['status_name'] = OrderEnum::refundStatus($item['refund_status']) ?? '';
}else{
$item['status_name'] = OrderEnum::getOrderType($item['status']) ?? ''; $item['status_name'] = OrderEnum::getOrderType($item['status']) ?? '';
}
if ($item['uid'] <= 0) { if ($item['uid'] <= 0) {
$item['nickname'] = '游客'; $item['nickname'] = '游客';
} else { } else {

View File

@ -47,7 +47,7 @@ class StoreOrderCartInfoLists extends BaseAdminDataLists implements ListsSearchI
return StoreOrderCartInfo::where($this->searchWhere) return StoreOrderCartInfo::where($this->searchWhere)
->field('cart_info,product_id,store_id')->limit($this->limitOffset, $this->limitLength) ->field('cart_info,product_id,store_id')->limit($this->limitOffset, $this->limitLength)
->select()->each(function ($item) { ->select()->each(function ($item) {
$find=StoreBranchProduct::where('product_id',$item['product_id'])->where('store_id',$item['store_id'])->field('image,store_name,store_info')->find(); $find=StoreProduct::where('id',$item['product_id'])->field('image,store_name,store_info')->find();
if($find){ if($find){
$item['image']=$find['image'];//商品图片 $item['image']=$find['image'];//商品图片
$item['store_name']=$find['store_name'];//商品名称 $item['store_name']=$find['store_name'];//商品名称

View File

@ -13,6 +13,7 @@ use app\common\model\user\UserAddress;
use app\common\model\vip_flow\VipFlow; use app\common\model\vip_flow\VipFlow;
use support\Db; use support\Db;
use app\common\lists\ListsSearchInterface; use app\common\lists\ListsSearchInterface;
use app\common\model\system_store\SystemStore;
class UserLists extends BaseAdminDataLists implements ListsExcelInterface,ListsSearchInterface class UserLists extends BaseAdminDataLists implements ListsExcelInterface,ListsSearchInterface
{ {
@ -44,7 +45,7 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface,ListsS
public function lists(): array public function lists(): array
{ {
$field = "id,nickname,real_name,sex,avatar,account,mobile,channel,create_time,purchase_funds,user_ship, $field = "id,nickname,real_name,sex,avatar,account,mobile,channel,create_time,purchase_funds,user_ship,
label_id,integral,now_money,total_recharge_amount,vip_time"; label_id,integral,now_money,total_recharge_amount,vip_time,store_id";
$lists = User::where($this->searchWhere) $lists = User::where($this->searchWhere)
->with(['user_ship','user_label']) ->with(['user_ship','user_label'])
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
@ -68,6 +69,10 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface,ListsS
if($item['label_name']== null){ if($item['label_name']== null){
$item['label_name'] = '无'; $item['label_name'] = '无';
} }
$item['store_name']='';
if($item['store_id']>0){
$item['store_name'] = SystemStore::where('id',$item['store_id'])->value('name');
}
$item['return_money'] = VipFlow:: $item['return_money'] = VipFlow::
where(['user_id'=>$item['id'],'status'=>0]) where(['user_id'=>$item['id'],'status'=>0])
->sum('number')??0; ->sum('number')??0;
@ -135,12 +140,17 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface,ListsS
public function setExcelFields(): array public function setExcelFields(): array
{ {
return [ return [
'sn' => '用户编号',
'nickname' => '用户昵称', 'nickname' => '用户昵称',
'real_name' => '真实姓名',
'account' => '账号', 'account' => '账号',
'mobile' => '手机号码', 'mobile' => '手机号码',
'channel' => '注册来源', 'now_money' => '用户余额',
'create_time' => '注册时间', 'integral' => '礼品券',
'vip_name' => '会员类型',
'store_name' => '门店',
'total_recharge_amount' => '累计消费',
'purchase_funds' => '采购款',
'format_address'=>'地址'
]; ];
} }
} }

View File

@ -2,9 +2,10 @@
namespace app\admin\logic\store_order; namespace app\admin\logic\store_order;
use app\common\enum\PayEnum;
use app\common\model\store_order\StoreOrder; use app\common\model\store_order\StoreOrder;
use app\common\logic\BaseLogic; use app\common\logic\BaseLogic;
use app\common\logic\PayNotifyLogic;
use app\common\model\store_order_cart_info\StoreOrderCartInfo; use app\common\model\store_order_cart_info\StoreOrderCartInfo;
use think\facade\Db; use think\facade\Db;
@ -29,9 +30,7 @@ class StoreOrderLogic extends BaseLogic
{ {
Db::startTrans(); Db::startTrans();
try { try {
StoreOrder::create([ StoreOrder::create([]);
]);
Db::commit(); Db::commit();
return true; return true;
@ -54,9 +53,7 @@ class StoreOrderLogic extends BaseLogic
{ {
Db::startTrans(); Db::startTrans();
try { try {
StoreOrder::where('id', $params['id'])->update([ StoreOrder::where('id', $params['id'])->update([]);
]);
Db::commit(); Db::commit();
return true; return true;
@ -90,11 +87,42 @@ class StoreOrderLogic extends BaseLogic
*/ */
public static function detail($params): array public static function detail($params): array
{ {
$data= StoreOrder::findOrEmpty($params['id']); $data = StoreOrder::findOrEmpty($params['id']);
if($data){ if ($data) {
$data['status_name']=$data->status_name_text; $data['status_name'] = $data->status_name_text;
$data['pay_time']=date('Y-m-d H:i:s',$data['pay_time']); $data['pay_time'] = date('Y-m-d H:i:s', $data['pay_time']);
} }
return $data?->toArray(); return $data?->toArray();
} }
public static function refund($detail, $params)
{
//微信支付
if (in_array($detail['pay_type'], [PayEnum::WECHAT_PAY_MINI, PayEnum::WECHAT_PAY_BARCODE])) {
$money = (int)bcmul($detail['pay_price'], 100);
$refund = (new \app\common\logic\store_order\StoreOrderLogic())
->refund($params['order_id'], $money, $money);
if ($refund) {
return '退款成功';
}
}
//余额支付 采购款支付
if (in_array($detail['pay_type'], [PayEnum::BALANCE_PAY, PayEnum::PURCHASE_FUNDS])) {
$money = bcmul($detail['pay_price'], 100);
$arr = [
'amount' => [
'refund' => $money
]
];
PayNotifyLogic::refund($params['order_id'], $arr);
return '退款成功';
}
//现金支付
if ($detail['pay_type'] = PayEnum::CASH_PAY) {
PayNotifyLogic::cash_refund($params['order_id']);
return '退款成功';
}
return false;
//todo 支付包支付
}
} }

View File

@ -2,6 +2,7 @@
namespace app\api\controller\order; namespace app\api\controller\order;
use app\admin\logic\store_order\StoreOrderLogic;
use app\api\logic\order\OrderLogic; use app\api\logic\order\OrderLogic;
use app\api\controller\BaseApiController; use app\api\controller\BaseApiController;
use app\api\lists\order\OrderList; use app\api\lists\order\OrderList;
@ -413,15 +414,9 @@ class OrderController extends BaseApiController
} }
} }
// #[ /**
// ApiDoc\Title('核销'), * 核销
// ApiDoc\url('/api/order/order/writeoff_order'), */
// ApiDoc\Method('POST'),
// ApiDoc\Param(name: "verify_code", type: "string", require: true, desc: "验证码"),
// ApiDoc\NotHeaders(),
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
// ApiDoc\ResponseSuccess("data", type: "array"),
// ]
public function writeoff_order() public function writeoff_order()
{ {
$params = (new OrderValidate())->post()->goCheck('check'); $params = (new OrderValidate())->post()->goCheck('check');
@ -453,25 +448,22 @@ class OrderController extends BaseApiController
} }
// #[ /**
// ApiDoc\Title('订单退款申请'), * 订单退款申请
// ApiDoc\url('/api/order/order/apply_refund'), */
// ApiDoc\Method('POST'),
// ApiDoc\Param(name: "refund_message", type: "string", require: true, desc: "退款原因"),
// ApiDoc\Param(name: "refund_num", type: "int", require: true, desc: "退款数量"),
// ApiDoc\Param(name: "id", type: "int", require: true, desc: "订单id"),
// ApiDoc\Param(name: "old_cart_id", type: "int", require: true, desc: "购物车id"),
// ApiDoc\Param(name: "refund_type", type: "int", require: true, desc: "退款申请类型"),
// ApiDoc\NotHeaders(),
// ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
// ApiDoc\ResponseSuccess("data", type: "array"),
// ]
public function apply_refund() public function apply_refund()
{ {
$params = (new OrderValidate())->post()->goCheck('add'); $params = (new OrderValidate())->post()->goCheck('add');
$uid = $this->userId; $uid = $this->userId;
//拆单逻辑 //拆单逻辑
OrderLogic::dealRefund($uid, $params); $res=OrderLogic::dealRefund($uid, $params);
$detail = StoreOrder::where('id', $params['id'])->where('refund_type',1)->find();
if($detail && $res!=2){
$res=StoreOrderLogic::refund($detail,['order_id'=>$detail['order_id']]);
if($res!=false){
return $this->success($res);
}
}
return $this->success('申请成功'); return $this->success('申请成功');
} }

View File

@ -102,6 +102,11 @@ class LoginLogic extends BaseLogic
//返回登录信息 //返回登录信息
$avatar = $user->avatar ?: Config::get('project.default_image.user_avatar'); $avatar = $user->avatar ?: Config::get('project.default_image.user_avatar');
$avatar = FileService::getFileUrl($avatar); $avatar = FileService::getFileUrl($avatar);
if($user->store_id){
$share_name=SystemStore::where('id',$user->store_id)->value('abbreviation');
}else{
$share_name=SystemStore::where('id',4)->value('abbreviation');
}
return [ return [
'avatar' => $avatar, 'avatar' => $avatar,
'id'=>$userInfo['user_id'], 'id'=>$userInfo['user_id'],
@ -113,6 +118,7 @@ class LoginLogic extends BaseLogic
// 'sn' => $userInfo['sn'], // 'sn' => $userInfo['sn'],
'token' => $userInfo['token'], 'token' => $userInfo['token'],
'real_name' => $userInfo['real_name'], 'real_name' => $userInfo['real_name'],
'share_name' => $share_name.'No.'.preg_replace('/4/','*', $user['id']),
]; ];
} catch (\Exception $e) { } catch (\Exception $e) {
self::setError($e->getMessage()); self::setError($e->getMessage());

View File

@ -18,6 +18,7 @@ use app\common\model\order\Cart;
use app\common\model\store_branch_product\StoreBranchProduct; use app\common\model\store_branch_product\StoreBranchProduct;
use app\common\model\store_category\StoreCategory; use app\common\model\store_category\StoreCategory;
use app\common\model\store_finance_flow\StoreFinanceFlow; use app\common\model\store_finance_flow\StoreFinanceFlow;
use app\common\model\store_finance_flow_product\StoreFinanceFlowProduct;
use app\common\model\store_order\StoreOrder; use app\common\model\store_order\StoreOrder;
use app\common\model\store_order_cart_info\StoreOrderCartInfo; use app\common\model\store_order_cart_info\StoreOrderCartInfo;
use app\common\model\store_product\StoreProduct; use app\common\model\store_product\StoreProduct;
@ -82,13 +83,13 @@ class OrderLogic extends BaseLogic
self::$fresh_price = 0; //生鲜金额 self::$fresh_price = 0; //生鲜金额
/** 计算价格 */ /** 计算价格 */
$off_activity = Config::where('name', 'off_activity')->value('value'); $off_activity = Config::where('name', 'off_activity')->value('value');
$field = 'id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id,top_cate_id,store_info'; $field = 'id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id,top_cate_id,store_info,rose';
foreach ($cart_select as $k => $v) { foreach ($cart_select as $k => $v) {
$find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->find(); $find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->find();
if (!$find) { if (!$find) {
// unset($cart_select[$k]); // unset($cart_select[$k]);
// continue; // continue;
$field = 'id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase, id product_id,cate_id,store_info'; $field = 'id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase, id product_id,cate_id,store_info,rose';
$find = StoreProduct::where(['id' => $v['product_id']])->field($field)->find(); $find = StoreProduct::where(['id' => $v['product_id']])->field($field)->find();
if ($find) { if ($find) {
$cate_id = StoreCategory::where('id', $find['cate_id'])->value('pid'); $cate_id = StoreCategory::where('id', $find['cate_id'])->value('pid');
@ -135,6 +136,7 @@ class OrderLogic extends BaseLogic
$cart_select[$k]['verify_code'] = $params['verify_code'] ?? ''; $cart_select[$k]['verify_code'] = $params['verify_code'] ?? '';
$cart_select[$k]['vip_frozen_price'] = 0; $cart_select[$k]['vip_frozen_price'] = 0;
$cart_select[$k]['store_info'] = $find['store_info']; $cart_select[$k]['store_info'] = $find['store_info'];
$cart_select[$k]['rose'] = $find['rose'];
//会员待返回金额 //会员待返回金额
// if ($user && $off_activity == 0) { // if ($user && $off_activity == 0) {
// if ($user['user_ship'] == 4) { // if ($user['user_ship'] == 4) {
@ -229,7 +231,7 @@ class OrderLogic extends BaseLogic
$store_id = getenv('STORE_ID') ?? 1; $store_id = getenv('STORE_ID') ?? 1;
$store['near_store'] = SystemStore::where('id', $store_id)->field('id,name,phone,address,detailed_address,latitude,longitude')->find() ?? []; $store['near_store'] = SystemStore::where('id', $store_id)->field('id,name,phone,address,detailed_address,latitude,longitude')->find() ?? [];
} }
$order['address_id'] = UserAddress::where('uid', $user['id'])->where('is_default', 1)->value('id')??0; $order['address_id'] = UserAddress::where('uid', $user['id'])->where('is_default', 1)->value('id') ?? 0;
} }
if (empty($store_check)) { if (empty($store_check)) {
if ((isset($params['lat']) && $params['lat'] != '') && (isset($params['long']) && $params['long'] != '')) { if ((isset($params['lat']) && $params['lat'] != '') && (isset($params['long']) && $params['long'] != '')) {
@ -290,12 +292,25 @@ class OrderLogic extends BaseLogic
// $_order['reservation_time'] = $params['reservation_time']; // $_order['reservation_time'] = $params['reservation_time'];
// $_order['reservation'] = YesNoEnum::YES; // $_order['reservation'] = YesNoEnum::YES;
// } // }
if ($addressId > 0 && $uid > 0) { if ($uid > 0) {
$address = UserAddress::where(['id' => $addressId, 'uid' => $uid])->find(); $address = UserAddress::where(['uid' => $uid])->find();
if ($address) { if ($address) {
$_order['real_name'] = $address['real_name']; $_order['real_name'] = $address['real_name'];
$_order['user_phone'] = $address['phone']; $_order['user_phone'] = $address['phone'];
$_order['user_address'] = $address['detail']; if ($address['area']) {
$_order['user_address'] = Db::name('geo_area')->where('area_code', $address['area'])->value('area_name') ?? '';
}
if ($address['street']) {
$street_name = Db::name('geo_street')->where('street_code', $address['street'])->value('street_name') ?? '';
$_order['user_address'] .= '/' . $street_name;
}
if ($address['village']) {
$village_name = Db::name('geo_village')->where('village_code', $address['village'])->value('village_name') ?? '';
$_order['user_address'] .= '/' . $village_name;
}
if ($address['brigade']) {
$_order['user_address'] .= '/' . $address['brigade'] ?? $address['brigade'] . '队';
}
} }
} }
if ($params['shipping_type'] == 2) { if ($params['shipping_type'] == 2) {
@ -575,12 +590,7 @@ class OrderLogic extends BaseLogic
'staff_id' => $params['staff_id'] ?? 0, 'staff_id' => $params['staff_id'] ?? 0,
], ['id' => $order['id']]); ], ['id' => $order['id']]);
//修改商品统计记录标识 //修改商品统计记录标识
(new StoreProductLog())->update( (new StoreProductLog())->where('oid', $order['id'])->update(['store_id' => $params['store_id']]);
[
'store_id' => $params['store_id']
],
['oid' => $order['id']]
);
(new StoreOrderCartInfo())->update([ (new StoreOrderCartInfo())->update([
'verify_code' => $params['verify_code'] . '-1', 'verify_code' => $params['verify_code'] . '-1',
'writeoff_time' => time(), 'writeoff_time' => time(),
@ -590,6 +600,10 @@ class OrderLogic extends BaseLogic
'update_time' => time(), 'update_time' => time(),
], ['oid' => $order['id']]); ], ['oid' => $order['id']]);
$financeFlow = new StoreFinanceFlow(); $financeFlow = new StoreFinanceFlow();
$res = $financeFlow->where('order_id', $order['id'])->update(['store_id' => $params['store_id'], 'staff_id' => $params['staff_id']]);
if ($res) {
$order['store_id'] = $params['store_id'];
}
$financeFlowLogic = new StoreFinanceFlowLogic(); $financeFlowLogic = new StoreFinanceFlowLogic();
$select_1 = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 1, 'financial_type' => ['in' => 14, 15, 16]])->select(); $select_1 = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 1, 'financial_type' => ['in' => 14, 15, 16]])->select();
foreach ($select_1 as $k => $v) { foreach ($select_1 as $k => $v) {
@ -818,7 +832,7 @@ class OrderLogic extends BaseLogic
} }
} }
return 1; return $order['status']??1;
} }

View File

@ -86,7 +86,7 @@ class UserLogic extends BaseLogic
{ {
$data = User::with(['userShip'])->where('id',$uid) $data = User::with(['userShip'])->where('id',$uid)
->field('id,avatar,real_name,nickname,account,mobile,sex,login_ip,now_money,total_recharge_amount,user_ship ->field('id,avatar,real_name,nickname,account,mobile,sex,login_ip,now_money,total_recharge_amount,user_ship
,purchase_funds,integral,pay_password,label_id') ,purchase_funds,integral,pay_password,label_id,store_id')
->find(); ->find();
//判断是不是员工 //判断是不是员工
if($data){ if($data){
@ -101,12 +101,10 @@ class UserLogic extends BaseLogic
$data['next_limit'] = $new['limit'] - $data['total_recharge_amount']; $data['next_limit'] = $new['limit'] - $data['total_recharge_amount'];
} }
$data['is_staff'] = 0; $data['is_staff'] = 0;
$data['store_id'] = 0;
if(isset($data['mobile']) && $data['mobile']){ if(isset($data['mobile']) && $data['mobile']){
$check = DeliveryService::where('phone',$data['mobile'])->find()??[]; $check = DeliveryService::where('phone',$data['mobile'])->find()??[];
if ($check){ if ($check){
$data['is_staff'] = 1; $data['is_staff'] = 1;
$data['store_id'] = $check['store_id'];
} }
} }
$data['label_name']=UserLabel::where('label_id',$data['label_id'])->value('label_name'); $data['label_name']=UserLabel::where('label_id',$data['label_id'])->value('label_name');
@ -125,6 +123,12 @@ class UserLogic extends BaseLogic
$number = UserSign::where('uid',$uid)->where(['status'=>0])->sum('number'); $number = UserSign::where('uid',$uid)->where(['status'=>0])->sum('number');
$data['number'] =bcadd($number,0,2); $data['number'] =bcadd($number,0,2);
$data['GetNumber'] =bcadd($GetNumber,0,2); $data['GetNumber'] =bcadd($GetNumber,0,2);
if($data['store_id']){
$share_name=SystemStore::where('id',$data['store_id'])->value('abbreviation');
}else{
$share_name=SystemStore::where('id',4)->value('abbreviation');
}
$data['share_name']= $share_name.'No.'.preg_replace('/4/','*', $data['id']);
}else{ }else{
$data = []; $data = [];
} }

View File

@ -22,8 +22,11 @@ class BaseLikeController extends BaseController
* @author 乔峰 * @author 乔峰
* @date 2021/12/27 14:21 * @date 2021/12/27 14:21
*/ */
protected function success(string $msg = 'success', array $data = [], int $code = 1, int $show = 0) protected function success(string $msg = 'success', $data = [], int $code = 1, int $show = 0)
{ {
if(is_object($data)){
$data = $data->toArray();
}
return JsonService::success($msg, $data, $code, $show); return JsonService::success($msg, $data, $code, $show);
} }
@ -36,6 +39,9 @@ class BaseLikeController extends BaseController
*/ */
protected function data($data) protected function data($data)
{ {
if(is_object($data)){
$data = $data->toArray();
}
return JsonService::data($data); return JsonService::data($data);
} }

View File

@ -3,6 +3,7 @@
namespace app\common\logic; namespace app\common\logic;
use app\common\enum\OrderEnum; use app\common\enum\OrderEnum;
use app\common\enum\PayEnum;
use app\common\model\finance\CapitalFlow; use app\common\model\finance\CapitalFlow;
class CapitalFlowLogic extends BaseLogic class CapitalFlowLogic extends BaseLogic
@ -72,12 +73,15 @@ class CapitalFlowLogic extends BaseLogic
$model->link_type = $linkType; $model->link_type = $linkType;
$model->link_id = $linkId; $model->link_id = $linkId;
$model->amount = $amount; $model->amount = $amount;
if ($payType == OrderEnum::BALANCE_PAYMEN_NO) { if ($payType == PayEnum::PURCHASE_FUNDS) {
$model->before_balance = $this->user['purchase_funds']; $model->before_balance = bcadd($this->user['purchase_funds'],$amount,2);
$model->balance = bcsub($this->user['purchase_funds'], $amount, 2); $model->balance = $this->user['purchase_funds'];
} else { } elseif ($payType == PayEnum::BALANCE_PAY){
$model->before_balance = bcadd($this->user['now_money'],$amount,2);
$model->balance = $this->user['now_money'];
}else{
$model->before_balance = $this->user['now_money']; $model->before_balance = $this->user['now_money'];
$model->balance = bcsub($this->user['now_money'], $amount, 2); $model->balance = $this->user['now_money'];
} }
$model->create_time = date('Y-m-d H:i:s'); $model->create_time = date('Y-m-d H:i:s');
$model->type = 'out'; $model->type = 'out';

View File

@ -93,7 +93,7 @@ class PayNotifyLogic extends BaseLogic
} }
// self::addUserSing($order); // self::addUserSing($order);
$capitalFlowDao = new CapitalFlowLogic($user); $capitalFlowDao = new CapitalFlowLogic($user);
$capitalFlowDao->userExpense('user_order_balance_pay', 'order', $order['id'], $order['pay_price'], '', 0, $order['store_id']); $capitalFlowDao->userExpense('user_order_balance_pay', 'order', $order['id'], $order['pay_price'], '', 3, $order['store_id']);
self::dealProductLog($order); self::dealProductLog($order);
self::afterPay($order); self::afterPay($order);
@ -203,7 +203,7 @@ class PayNotifyLogic extends BaseLogic
$user->save(); $user->save();
$capitalFlowDao = new CapitalFlowLogic($user); $capitalFlowDao = new CapitalFlowLogic($user);
$capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $order['id'], $order['pay_price'], '', 1, $order['store_id']); $capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $order['id'], $order['pay_price'], '', 18, $order['store_id']);
// if ($user['user_ship'] == 1) { // if ($user['user_ship'] == 1) {
// self::dealVipAmount($order, PayEnum::PURCHASE_FUNDS); // self::dealVipAmount($order, PayEnum::PURCHASE_FUNDS);
// } // }
@ -263,7 +263,7 @@ class PayNotifyLogic extends BaseLogic
} else { } else {
$capitalFlowDao = new CapitalFlowLogic($user); $capitalFlowDao = new CapitalFlowLogic($user);
//微信支付和用户余额无关 //微信支付和用户余额无关
$capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order->pay_price, '', 1, $order['store_id']); $capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order->pay_price, '', 0, $order['store_id']);
} }
$order->save(); $order->save();
if ($order['reservation'] == 1 && in_array($order['shipping_type'], [1, 2])) { if ($order['reservation'] == 1 && in_array($order['shipping_type'], [1, 2])) {
@ -304,10 +304,10 @@ class PayNotifyLogic extends BaseLogic
$capitalFlowDao = new CapitalFlowLogic($user); $capitalFlowDao = new CapitalFlowLogic($user);
if ($purchase_funds >= $orderRe['price']) { if ($purchase_funds >= $orderRe['price']) {
User::where('id', $orderRe['uid'])->dec('purchase_funds', $orderRe['refund_price'])->update(); User::where('id', $orderRe['uid'])->dec('purchase_funds', $orderRe['refund_price'])->update();
$capitalFlowDao->userExpense('user_balance_recharge_refund', 'order', $orderRe['id'], $orderRe['refund_price'], '', 1, $orderRe['store_id']); $capitalFlowDao->userExpense('user_balance_recharge_refund', 'order', $orderRe['id'], $orderRe['refund_price'], '', 0, $orderRe['store_id']);
} else { } else {
User::where('id', $orderRe['uid'])->dec('purchase_funds', $purchase_funds)->update(); User::where('id', $orderRe['uid'])->dec('purchase_funds', $purchase_funds)->update();
$capitalFlowDao->userExpense('user_balance_recharge_refund', 'order', $orderRe['id'], $purchase_funds, '', 1, $orderRe['store_id']); $capitalFlowDao->userExpense('user_balance_recharge_refund', 'order', $orderRe['id'], $purchase_funds, '', 0, $orderRe['store_id']);
} }
//退还 充值得兑换券 //退还 充值得兑换券
UserSignLogic::RefundRecharge($orderRe); UserSignLogic::RefundRecharge($orderRe);

View File

@ -40,7 +40,11 @@ class StoreOrder extends BaseModel
public function getStatusNameTextAttr($value, $data) public function getStatusNameTextAttr($value, $data)
{ {
if($data['status']==-1){
$status = OrderEnum::refundStatus($data['refund_status']) ?? '';
}else{
$status = OrderEnum::getOrderType($data['status']) ?? ''; $status = OrderEnum::getOrderType($data['status']) ?? '';
}
return $status; return $status;
} }

View File

@ -43,7 +43,8 @@ class OrderWetchaPushSend implements Consumer
$cart_info=StoreOrderCartInfo::where('oid',$order['id'])->field('cart_info')->select(); $cart_info=StoreOrderCartInfo::where('oid',$order['id'])->field('cart_info')->select();
$product_info="\r\n>商品信息:<font color=\"comment\">------------------</font>"; $product_info="\r\n>商品信息:<font color=\"comment\">------------------</font>";
foreach($cart_info as $k=>$v['cart_info']){ foreach($cart_info as $k=>$v['cart_info']){
$a=$v['cart_info']['cart_info']['name'].' 数量:'.$v['cart_info']['cart_info']['cart_num'].' 价格:'.$v['cart_info']['cart_info']['pay_price'].'元'; $unit_name=$v['cart_info']['cart_info']['unit_name']??'';
$a=$v['cart_info']['cart_info']['name'].' 数量:'.$v['cart_info']['cart_info']['cart_num'].$unit_name.' 价格:'.$v['cart_info']['cart_info']['pay_price'].'元';
$product_info.="\r\n><font color=\"comment\">$a</font>"; $product_info.="\r\n><font color=\"comment\">$a</font>";
} }
$arr = ["msgtype" => "markdown", "markdown" => ["content" => "有新的订单请及时跟踪 $arr = ["msgtype" => "markdown", "markdown" => ["content" => "有新的订单请及时跟踪

View File

@ -66,6 +66,7 @@ class WorkbenchLogic extends BaseLogic
$storeFinanceWhere['store_id'] = $params['store_id']; $storeFinanceWhere['store_id'] = $params['store_id'];
$storeFinanceWhereTwo['store_id'] = $params['store_id']; $storeFinanceWhereTwo['store_id'] = $params['store_id'];
$attritionWhere['id'] = $params['store_id']; $attritionWhere['id'] = $params['store_id'];
$all_where['store_id'] = $params['store_id'];
} }
$orderLogic = new StoreOrderLogic(); $orderLogic = new StoreOrderLogic();
//订单总金额 //订单总金额