Merge branch 'dev' of https://gitea.lihaink.cn/mkm/multi-store into dev
This commit is contained in:
commit
eb57117246
@ -19,6 +19,7 @@ use app\common\enum\YesNoEnum;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\finance\CapitalFlow;
|
||||
use app\common\model\store_finance_flow\StoreFinanceFlow;
|
||||
use app\common\model\store_order\StoreOrder;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user\UserAddress;
|
||||
use app\common\model\user\UserRecharge;
|
||||
@ -189,24 +190,32 @@ class UserLogic extends BaseLogic
|
||||
switch ($params['type']){
|
||||
case 1:
|
||||
//采购款明细
|
||||
$query =CapitalFlow::where(['uid'=>$params['id']]);
|
||||
$categories = ['user_balance_recharge', 'user_order_purchase_pay'];
|
||||
$query = CapitalFlow::where('uid', $params['id'])
|
||||
->whereIn('category', $categories);
|
||||
$count = $query->count();
|
||||
$data = $query
|
||||
->page($params['page_no'],$params['page_size'])
|
||||
->select()->toArray();
|
||||
foreach ($data as &$value){
|
||||
if($value['category'] == 'user_order_purchase_pay'){
|
||||
$value['order_sn'] = StoreOrder::where('id',$value['link_id'])->value('order_id');
|
||||
}elseif($value['category'] == 'user_balance_recharge'){
|
||||
$value['order_sn'] = UserRecharge::where('id',$value['link_id'])->value('order_id');
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
//余额明细
|
||||
|
||||
$query = StoreFinanceFlow::with(['store'])
|
||||
->where([
|
||||
'other_uid'=>$params['id'],'financial_type'=> OrderEnum::VIP_ORDER_OBTAINS,
|
||||
'financial_pm'=>YesNoEnum::YES
|
||||
]);
|
||||
$query = CapitalFlow::where('uid', $params['id'])
|
||||
->where('category', 'user_order_balance_pay');
|
||||
$count = $query->count();
|
||||
$data = $query
|
||||
->page($params['page_no'],$params['page_size'])
|
||||
->select()->toArray();
|
||||
foreach ($data as &$value){
|
||||
$value['order_sn'] = StoreOrder::where('id',$value['link_id'])->value('order_id');
|
||||
}
|
||||
|
||||
break;
|
||||
case 3:
|
||||
|
@ -5,6 +5,7 @@ namespace app\api\logic\order;
|
||||
|
||||
use app\common\model\order\Cart;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\store_product_log\StoreProductLog;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
@ -32,7 +33,7 @@ class CartLogic extends BaseLogic
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
Cart::create([
|
||||
$cart = Cart::create([
|
||||
'uid' => $params['uid'],
|
||||
'type' => $params['type']??'',
|
||||
'product_id' => $params['product_id'],
|
||||
@ -42,6 +43,15 @@ class CartLogic extends BaseLogic
|
||||
'cart_num' => $params['cart_num'],
|
||||
'is_new' => $params['is_new']??0,
|
||||
]);
|
||||
StoreProductLog::create([
|
||||
'type'=>'cart',
|
||||
'uid' => $params['uid'],
|
||||
'cart_id' => $cart['id'],
|
||||
'store_id' => $params['store_id']??0,
|
||||
'visit_num' => 1,
|
||||
'product_id' => $params['product_id'],
|
||||
'cart_num' => $params['cart_num'],
|
||||
]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
|
@ -134,6 +134,9 @@ class OrderLogic extends BaseLogic
|
||||
}else{
|
||||
$pay_price =bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额
|
||||
}
|
||||
if($pay_price < 500){
|
||||
throw new Exception('金额低于500');
|
||||
}
|
||||
|
||||
$vipPrice = 0;
|
||||
//成本价 收益
|
||||
|
@ -19,7 +19,7 @@ class CartValidate extends BaseValidate
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'cart_num' => 'require|number',
|
||||
'cart_num' => 'require',
|
||||
'product_attr_unique' => 'require',
|
||||
'store_id' => 'require|number',
|
||||
'staff_id' => 'require|number',
|
||||
|
@ -86,7 +86,7 @@ class PayNotifyLogic extends BaseLogic
|
||||
}
|
||||
}
|
||||
$capitalFlowDao = new CapitalFlowLogic($user);
|
||||
$capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order['pay_price'],'',0,$order['store_id']);
|
||||
$capitalFlowDao->userExpense('user_order_balance_pay', 'order', $order['id'], $order['pay_price'],'',0,$order['store_id']);
|
||||
// self::afterPay($order);
|
||||
// Redis::send('push-platform-print', ['id' => $order['id']], 60);
|
||||
// PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
||||
|
Loading…
x
Reference in New Issue
Block a user