|
|
@@ -12,6 +12,7 @@ namespace app\controller\api\store\order;
|
|
12
|
12
|
|
|
13
|
13
|
|
|
14
|
14
|
use app\common\model\store\order\StoreRefundOrder;
|
|
|
15
|
+use app\common\model\system\admin\Log;
|
|
15
|
16
|
use app\common\repositories\merchant\MerchantRepository;
|
|
16
|
17
|
use app\common\repositories\store\product\ProductAttrValueRepository;
|
|
17
|
18
|
use app\common\repositories\user\UserAddressRepository;
|
|
|
@@ -124,6 +125,11 @@ class StoreOrder extends BaseController
|
|
124
|
125
|
$decJingScore = $this->request->param('decJingScore','');//消耗京豆值
|
|
125
|
126
|
$uid = $this->request->uid();
|
|
126
|
127
|
$gong = app()->make(ProductAttrValueRepository::class);
|
|
|
128
|
+
|
|
|
129
|
+ \think\facade\Log::info("createOrder params".json_encode(input()));
|
|
|
130
|
+ $payType = 5;
|
|
|
131
|
+ $decScore = 100;
|
|
|
132
|
+
|
|
127
|
133
|
// Db::name('log')->insert(['data'=>'购物车ID---'.$cartId[0]]);
|
|
128
|
134
|
$price=0;
|
|
129
|
135
|
// if (!in_array($payType, StoreOrderRepository::PAY_TYPE))
|
|
|
@@ -385,19 +391,19 @@ class StoreOrder extends BaseController
|
|
385
|
391
|
//删除缓存的优惠价格
|
|
386
|
392
|
Cache::delete($uid.'_youhui_price_'.$product_type_id);
|
|
387
|
393
|
|
|
388
|
|
- if($payType==5){
|
|
389
|
|
-
|
|
390
|
|
-
|
|
391
|
|
- $this->repository->integralPaySuccess($groupOrder,5);
|
|
392
|
|
- //积分商品
|
|
393
|
|
- $order_id=Db::name('store_order')->where('group_order_id',$groupOrder['group_order_id'])->value('order_id');
|
|
394
|
|
-
|
|
395
|
|
- $userRepository = app()->make(UserRepository::class);
|
|
396
|
|
- if ($special_merchant == "beishengtang"){
|
|
397
|
|
- $userRepository -> sign_add($uid,$price,1,'积分消费','','',$order_id,2,"store_order_beishengtang");
|
|
398
|
|
- }else{
|
|
399
|
|
- $userRepository -> sign_add($uid,$price*30,1,'积分消费','','',$order_id,2,'store_order');
|
|
400
|
|
- }
|
|
|
394
|
+// if($payType==5){
|
|
|
395
|
+//
|
|
|
396
|
+//
|
|
|
397
|
+// $this->repository->integralPaySuccess($groupOrder,5);
|
|
|
398
|
+// //积分商品
|
|
|
399
|
+// $order_id=Db::name('store_order')->where('group_order_id',$groupOrder['group_order_id'])->value('order_id');
|
|
|
400
|
+//
|
|
|
401
|
+// $userRepository = app()->make(UserRepository::class);
|
|
|
402
|
+// if ($special_merchant == "beishengtang"){
|
|
|
403
|
+// $userRepository -> sign_add($uid,$price,1,'积分消费','','',$order_id,2,"store_order_beishengtang");
|
|
|
404
|
+// }else{
|
|
|
405
|
+// $userRepository -> sign_add($uid,$price*30,1,'积分消费','','',$order_id,2,'store_order');
|
|
|
406
|
+// }
|
|
401
|
407
|
|
|
402
|
408
|
|
|
403
|
409
|
// Db::name('user') -> where('uid',$uid) -> dec('score', $price*30)->update();
|
|
|
@@ -439,67 +445,67 @@ class StoreOrder extends BaseController
|
|
439
|
445
|
// Db::name('entropy_barter_bill')->insert($insert);
|
|
440
|
446
|
return app('json')->status('success', '支付成功', ['order_id' => $groupOrder['group_order_id']]);
|
|
441
|
447
|
//
|
|
442
|
|
- }else if($payType==6){
|
|
443
|
|
- //积分商品
|
|
444
|
|
- $userRepository = app()->make(UserRepository::class);
|
|
445
|
|
- $order_id=Db::name('store_order')->where('group_order_id',$groupOrder['group_order_id'])->value('order_id');
|
|
446
|
|
- $hongjifen_kou=$userRepository -> sign_yhc_add($uid,$this->merId,$red_jifen,'兑换合伙人商品('.$ex_user['nickname'].')',$order_id,2,$ex_user['uid']);
|
|
447
|
|
- if(!$hongjifen_kou){
|
|
448
|
|
- return app('json')->fail('用户红积分不足,请刷新后再试');
|
|
449
|
|
- }
|
|
450
|
|
-
|
|
451
|
|
-
|
|
452
|
|
- Db::name('store_order')->where('group_order_id',$groupOrder['group_order_id'])->update(['exchange_phone'=>$exchange_phone]);
|
|
453
|
|
-
|
|
454
|
|
- $this->repository->integralPaySuccess($groupOrder,5);
|
|
455
|
|
-
|
|
456
|
|
-
|
|
457
|
|
- $enterprise_user=Db::name('enterprise_user')->where('uid',$ex_user['uid'])-> where('mer_id',$this->merId)->find();
|
|
458
|
|
- if($enterprise_user && $enterprise_user['identity']<100){ //不是合伙人就升级为合伙人
|
|
459
|
|
- Db::name('enterprise_user')->where('uid',$enterprise_user['uid'])->where('mer_id',$enterprise_user['mer_id'])->update(['identity'=>100,'exchange'=>100]);
|
|
460
|
|
- }
|
|
461
|
|
-
|
|
462
|
|
-
|
|
463
|
|
-
|
|
464
|
|
- $order=Db::name('store_order')->where('order_id',$order_id)->find();
|
|
465
|
|
- $store_order_product =Db::name('store_order_product')->where('order_id',$order_id)->where('type',17)->find();
|
|
466
|
|
- $cart_info=json_decode($store_order_product['cart_info'],true);
|
|
467
|
|
- $pay_price =$order['pay_price'];
|
|
468
|
|
- $unique=isset($cart_info['productAttr']['unique'])?$cart_info['productAttr']['unique']:'';
|
|
469
|
|
- $product_id=isset($cart_info['product']['product_id'])?$cart_info['product']['product_id']:'';
|
|
470
|
|
- if($unique){
|
|
471
|
|
- $store_product_attr_value=Db::name('store_product_attr_value')->where('unique',$unique)->find();
|
|
472
|
|
- }
|
|
473
|
|
- if($product_id && isset($store_product_attr_value)){
|
|
474
|
|
- $product_data=Db::name('store_product')->where('product_id',$product_id)->find();
|
|
475
|
|
- if($product_data && $product_data['pension_is']==1 && isset($store_product_attr_value['pension_num']) ){
|
|
476
|
|
- $member_settings['ylj']=$store_product_attr_value['pension_num'];//养老金比例单独设置
|
|
477
|
|
- }
|
|
478
|
|
-
|
|
479
|
|
- Db::name('enterprise_user')->where('uid',$enterprise_user['uid'])->inc('stock_right',$store_product_attr_value['stock_num'])->inc('stock_num',$store_product_attr_value['shares_num'])->update();
|
|
480
|
|
-
|
|
481
|
|
- }
|
|
482
|
|
-
|
|
483
|
|
-
|
|
484
|
|
- $user_yanglaojin=decimal2($member_settings['ylj']/100*$pay_price);//养老金 一壶茶会员商户从2后台设置比例
|
|
485
|
|
-
|
|
486
|
|
-
|
|
487
|
|
-
|
|
488
|
|
-
|
|
489
|
|
-
|
|
490
|
|
-
|
|
491
|
|
- $StoreOrderRepository = app()->make(StoreOrderRepository::class);
|
|
492
|
|
-
|
|
493
|
|
-
|
|
494
|
|
-
|
|
495
|
|
- if($user_yanglaojin>=0.01) {
|
|
496
|
|
- $order_sn=Db::name('store_order')->where('group_order_id',$groupOrder['group_order_id'])->value('order_sn');
|
|
497
|
|
- $StoreOrderRepository->add_bill_gongfu("养老金", $user_yanglaojin, $enterprise_user['uid'], "商城消费获得养老金" . $user_yanglaojin, 5, $order_sn, $order_id, $enterprise_user['mer_id'], 0, 0);
|
|
498
|
|
- }
|
|
499
|
|
-
|
|
500
|
|
-
|
|
501
|
|
- return app('json')->status('success', '支付成功', ['order_id' => $groupOrder['group_order_id']]);
|
|
502
|
|
- }
|
|
|
448
|
+// }else if($payType==6){
|
|
|
449
|
+// //积分商品
|
|
|
450
|
+// $userRepository = app()->make(UserRepository::class);
|
|
|
451
|
+// $order_id=Db::name('store_order')->where('group_order_id',$groupOrder['group_order_id'])->value('order_id');
|
|
|
452
|
+// $hongjifen_kou=$userRepository -> sign_yhc_add($uid,$this->merId,$red_jifen,'兑换合伙人商品('.$ex_user['nickname'].')',$order_id,2,$ex_user['uid']);
|
|
|
453
|
+// if(!$hongjifen_kou){
|
|
|
454
|
+// return app('json')->fail('用户红积分不足,请刷新后再试');
|
|
|
455
|
+// }
|
|
|
456
|
+//
|
|
|
457
|
+//
|
|
|
458
|
+// Db::name('store_order')->where('group_order_id',$groupOrder['group_order_id'])->update(['exchange_phone'=>$exchange_phone]);
|
|
|
459
|
+//
|
|
|
460
|
+// $this->repository->integralPaySuccess($groupOrder,5);
|
|
|
461
|
+//
|
|
|
462
|
+//
|
|
|
463
|
+// $enterprise_user=Db::name('enterprise_user')->where('uid',$ex_user['uid'])-> where('mer_id',$this->merId)->find();
|
|
|
464
|
+// if($enterprise_user && $enterprise_user['identity']<100){ //不是合伙人就升级为合伙人
|
|
|
465
|
+// Db::name('enterprise_user')->where('uid',$enterprise_user['uid'])->where('mer_id',$enterprise_user['mer_id'])->update(['identity'=>100,'exchange'=>100]);
|
|
|
466
|
+// }
|
|
|
467
|
+//
|
|
|
468
|
+//
|
|
|
469
|
+//
|
|
|
470
|
+// $order=Db::name('store_order')->where('order_id',$order_id)->find();
|
|
|
471
|
+// $store_order_product =Db::name('store_order_product')->where('order_id',$order_id)->where('type',17)->find();
|
|
|
472
|
+// $cart_info=json_decode($store_order_product['cart_info'],true);
|
|
|
473
|
+// $pay_price =$order['pay_price'];
|
|
|
474
|
+// $unique=isset($cart_info['productAttr']['unique'])?$cart_info['productAttr']['unique']:'';
|
|
|
475
|
+// $product_id=isset($cart_info['product']['product_id'])?$cart_info['product']['product_id']:'';
|
|
|
476
|
+// if($unique){
|
|
|
477
|
+// $store_product_attr_value=Db::name('store_product_attr_value')->where('unique',$unique)->find();
|
|
|
478
|
+// }
|
|
|
479
|
+// if($product_id && isset($store_product_attr_value)){
|
|
|
480
|
+// $product_data=Db::name('store_product')->where('product_id',$product_id)->find();
|
|
|
481
|
+// if($product_data && $product_data['pension_is']==1 && isset($store_product_attr_value['pension_num']) ){
|
|
|
482
|
+// $member_settings['ylj']=$store_product_attr_value['pension_num'];//养老金比例单独设置
|
|
|
483
|
+// }
|
|
|
484
|
+//
|
|
|
485
|
+// Db::name('enterprise_user')->where('uid',$enterprise_user['uid'])->inc('stock_right',$store_product_attr_value['stock_num'])->inc('stock_num',$store_product_attr_value['shares_num'])->update();
|
|
|
486
|
+//
|
|
|
487
|
+// }
|
|
|
488
|
+//
|
|
|
489
|
+//
|
|
|
490
|
+// $user_yanglaojin=decimal2($member_settings['ylj']/100*$pay_price);//养老金 一壶茶会员商户从2后台设置比例
|
|
|
491
|
+//
|
|
|
492
|
+//
|
|
|
493
|
+//
|
|
|
494
|
+//
|
|
|
495
|
+//
|
|
|
496
|
+//
|
|
|
497
|
+// $StoreOrderRepository = app()->make(StoreOrderRepository::class);
|
|
|
498
|
+//
|
|
|
499
|
+//
|
|
|
500
|
+//
|
|
|
501
|
+// if($user_yanglaojin>=0.01) {
|
|
|
502
|
+// $order_sn=Db::name('store_order')->where('group_order_id',$groupOrder['group_order_id'])->value('order_sn');
|
|
|
503
|
+// $StoreOrderRepository->add_bill_gongfu("养老金", $user_yanglaojin, $enterprise_user['uid'], "商城消费获得养老金" . $user_yanglaojin, 5, $order_sn, $order_id, $enterprise_user['mer_id'], 0, 0);
|
|
|
504
|
+// }
|
|
|
505
|
+//
|
|
|
506
|
+//
|
|
|
507
|
+// return app('json')->status('success', '支付成功', ['order_id' => $groupOrder['group_order_id']]);
|
|
|
508
|
+// }
|
|
503
|
509
|
if ($groupOrder['pay_price'] == 0) {
|
|
504
|
510
|
$this->repository->paySuccess($groupOrder);
|
|
505
|
511
|
return app('json')->status('success', '支付成功', ['order_id' => $groupOrder['group_order_id']]);
|