|
|
@@ -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;
|
|
|
@@ -110,7 +111,7 @@ class StoreOrder extends BaseController
|
|
110
|
111
|
$coupon = (array)$this->request->param('coupon', []);
|
|
111
|
112
|
$take = (array)$this->request->param('take', []);
|
|
112
|
113
|
$mark = (array)$this->request->param('mark', []);
|
|
113
|
|
- $payType = $this->request->param('pay_type');
|
|
|
114
|
+ $payType = $this->request->param('pay_type');// 5积分 6京豆
|
|
114
|
115
|
$share_id = $this->request->param('share_id','');//分享id
|
|
115
|
116
|
$mer_id = $this->request->param('mer_id','');//分享id
|
|
116
|
117
|
$psType = $this->request->param('type',true);//是否需要地址Boolean
|
|
|
@@ -120,8 +121,20 @@ class StoreOrder extends BaseController
|
|
120
|
121
|
$distribution_mode = $this->request->param('distribution_mode','1');//配送方式
|
|
121
|
122
|
$ziti_address = $this->request->param('distribution_address','');//自提地址
|
|
122
|
123
|
$youhui_price_key = $this->request->param('youhui_price_key','');//优惠key
|
|
|
124
|
+ $cartIdAndPayTypMap = (array)$this->request->param('cartIdAndPayTypMap', []);
|
|
|
125
|
+
|
|
|
126
|
+ if(!$cartIdAndPayTypMap){
|
|
|
127
|
+ return app('json')->fail('支付方式不正确');
|
|
|
128
|
+ }
|
|
123
|
129
|
$uid = $this->request->uid();
|
|
124
|
130
|
$gong = app()->make(ProductAttrValueRepository::class);
|
|
|
131
|
+
|
|
|
132
|
+ $allParams = input();
|
|
|
133
|
+ \think\facade\Log::info("createOrder params".json_encode($allParams));
|
|
|
134
|
+
|
|
|
135
|
+ $cartId = $allParams['cart_id'];
|
|
|
136
|
+ \think\facade\Log::info("createOrder cart_id".json_encode($cartId));
|
|
|
137
|
+
|
|
125
|
138
|
// Db::name('log')->insert(['data'=>'购物车ID---'.$cartId[0]]);
|
|
126
|
139
|
$price=0;
|
|
127
|
140
|
// if (!in_array($payType, StoreOrderRepository::PAY_TYPE))
|
|
|
@@ -132,102 +145,73 @@ class StoreOrder extends BaseController
|
|
132
|
145
|
$special_merchant = merchantConfig($product_mer_id, 'special_merchant');
|
|
133
|
146
|
$member_settings=merchantConfig($product_mer_id, 'member_settings');
|
|
134
|
147
|
|
|
135
|
|
- return app('json')->fail('正在升级');
|
|
136
|
148
|
// 增加锁,防止同一用户重读点击
|
|
137
|
149
|
$redis = Cache::store('redis')->handler();
|
|
138
|
150
|
$key = 'createOrder'.$uid;
|
|
139
|
151
|
if (!$redis->setnx($key, 1))
|
|
140
|
152
|
return app('json')->fail('请勿重复下单');
|
|
141
|
153
|
$redis->expire($key, 3);
|
|
|
154
|
+ if (!in_array($payType, [5, 6])) {
|
|
|
155
|
+ return app('json')->fail('支付方式不正确');
|
|
|
156
|
+ }
|
|
142
|
157
|
|
|
143
|
158
|
$user_group = (int)Db::name('user') -> where('uid',$uid)->value('user_group');
|
|
144
|
|
- if($payType=='5'){
|
|
145
|
|
- //$product_mer_id!=148&&$product_mer_id!==290&&
|
|
146
|
|
-
|
|
147
|
159
|
|
|
148
|
|
- if(empty($mer_id) || ($product_mer_id!=148 && $special_merchant != "beishengtang")) {
|
|
149
|
|
- return app('json')->fail('此商户/商品不支持积分支付');
|
|
150
|
|
- }
|
|
151
|
|
-
|
|
152
|
|
-// Db::name('log')->insert(['data'=>'购物车ID'.json_encode($cartId)]);
|
|
153
|
|
- $cartIds=Db::name('store_cart')->where('cart_id','in',$cartId)->select()->toArray();
|
|
154
|
|
-
|
|
155
|
|
-// Db::name('log')->insert(['data'=>'购物车数据'.json_encode($cartIds)]);
|
|
156
|
|
- foreach ($cartIds as $k=>$item){
|
|
157
|
|
- $checkGong = $gong -> checkGong($item['product_id'],$item['product_attr_unique'],$item['cart_num'],$uid,$addressId);
|
|
158
|
|
- if(isset($checkGong['code']) && $checkGong['code'] == -1) return app('json')->fail($checkGong['message']);
|
|
159
|
|
- $money=Db::name('store_product_attr_value')->where('unique',$item['product_attr_unique'])->value('price');
|
|
160
|
|
- $price+=bcmul($money,$item['cart_num'],2);
|
|
161
|
|
- }
|
|
162
|
|
-// $have_money=Db::name('entropy_barter_user_'.$mer_id)->where('uid',$uid)->value('integral');
|
|
163
|
|
- if ($special_merchant == "beishengtang"){
|
|
164
|
|
- $have_money = Db::name('user') -> where('uid',$uid) -> value('score_beishengtang');
|
|
165
|
|
- if($have_money<$price){
|
|
166
|
|
- return app('json')->fail('积分不足无法支付');
|
|
167
|
|
- }
|
|
168
|
|
- }else{
|
|
169
|
|
-
|
|
170
|
|
- $have_money = Db::name('user') -> where('uid',$uid) -> value('score');
|
|
171
|
|
- if($have_money<$price*30){
|
|
172
|
|
- return app('json')->fail('积分不足无法支付');
|
|
|
160
|
+// $cartIdAndPayTypMap = [
|
|
|
161
|
+// 13662 => 'score',
|
|
|
162
|
+// 13663 => 'jingdou',
|
|
|
163
|
+// 13664 => 'jingdou',
|
|
|
164
|
+// ];
|
|
|
165
|
+// $cartId = [
|
|
|
166
|
+// 13662, 订单1
|
|
|
167
|
+// 13663, 订单1
|
|
|
168
|
+// 13664 订单2
|
|
|
169
|
+// ];
|
|
|
170
|
+
|
|
|
171
|
+ // 商品A 后台设置是扣除60积分 或者 扣除120京豆
|
|
|
172
|
+ // 商品B 后台设置是扣除20积分 或者 扣除40京豆
|
|
|
173
|
+ // payType=5 积分支付的时候
|
|
|
174
|
+ //
|
|
|
175
|
+ $cartList=Db::name('store_cart')->where('cart_id','in',$cartId)->select()->toArray();
|
|
|
176
|
+ $price = $decScore = $decJingScore = 0;//总消耗积分和京豆
|
|
|
177
|
+ foreach ($cartList as $cartInfo){
|
|
|
178
|
+ $checkGong = $gong -> checkGong($cartInfo['product_id'],$cartInfo['product_attr_unique'],$cartInfo['cart_num'],$uid,$addressId);
|
|
|
179
|
+ if(isset($checkGong['code']) && $checkGong['code'] == -1) return app('json')->fail($checkGong['message']);
|
|
|
180
|
+ $money=Db::name('store_product_attr_value')->where('unique',$cartInfo['product_attr_unique'])->value('price');
|
|
|
181
|
+ $price += bcmul($money, $cartInfo['cart_num'], 2);
|
|
|
182
|
+
|
|
|
183
|
+ $storeProduct = Db::name('store_product')->where('product_id', $cartInfo['product_id'])->find();
|
|
|
184
|
+ $productDecScore = $storeProduct['score'];
|
|
|
185
|
+ $productDecJingdou = $storeProduct['jingdou'];
|
|
|
186
|
+
|
|
|
187
|
+ $itemCartId = $cartInfo['cart_id'];
|
|
|
188
|
+ if ($cartIdAndPayTypMap[$itemCartId] == 'score') {
|
|
|
189
|
+ //积分支付的话
|
|
|
190
|
+ if ($productDecScore == 0) {
|
|
|
191
|
+ return app('json')->fail($storeProduct['store_name'] . '必须消耗积分');
|
|
173
|
192
|
}
|
|
174
|
|
- }
|
|
175
|
|
-
|
|
176
|
|
-
|
|
177
|
|
- }else if($payType==6){
|
|
178
|
|
- //一壶茶红积分兑换
|
|
179
|
|
- $cartIds=Db::name('store_cart')->where('cart_id','in',$cartId)->select()->toArray();
|
|
180
|
|
- $red_jifen=0;
|
|
181
|
|
- foreach ($cartIds as $k=>$item){
|
|
182
|
|
- $s_type = Db::name('store_product') -> where('product_id', $item['product_id']) -> value('type');
|
|
183
|
|
- if($s_type!=17){
|
|
184
|
|
- return app('json')->fail('只有会员商品才能使用积分');
|
|
|
193
|
+ $decScore += $productDecScore;
|
|
|
194
|
+ } else if ($cartIdAndPayTypMap[$itemCartId] == 'jingdou') {
|
|
|
195
|
+ //京豆支付的话
|
|
|
196
|
+ if ($productDecJingdou == 0) {
|
|
|
197
|
+ return app('json')->fail($storeProduct['store_name'] . '必须消耗京豆');
|
|
185
|
198
|
}
|
|
186
|
|
-
|
|
187
|
|
- $checkGong = $gong -> checkGong($item['product_id'],$item['product_attr_unique'],$item['cart_num'],$uid,$addressId);
|
|
188
|
|
- if(isset($checkGong['code']) && $checkGong['code'] == -1) return app('json')->fail($checkGong['message']);
|
|
189
|
|
- $money=Db::name('store_product_attr_value')->where('unique',$item['product_attr_unique'])->value('price');
|
|
190
|
|
- $red_jifen+=bcmul($money,$item['cart_num'],2);
|
|
191
|
|
- }
|
|
192
|
|
- $red_jifen=ceil($red_jifen);
|
|
193
|
|
-
|
|
194
|
|
- $enterprise_user_data = Db::name('enterprise_user') -> where('uid',$uid)-> where('mer_id',$this->merId) ->find();
|
|
195
|
|
- $green_integral = $enterprise_user_data['green_integral'];
|
|
196
|
|
- if(!$green_integral || $green_integral < $red_jifen){
|
|
197
|
|
- return app('json')->fail('用户红积分不足,请刷新后再试');
|
|
198
|
|
- }
|
|
199
|
|
- if($enterprise_user_data['identity'] < 100){
|
|
200
|
|
- return app('json')->fail('需要您升级为合伙人');
|
|
201
|
|
- }
|
|
202
|
|
-
|
|
203
|
|
-
|
|
204
|
|
- $exchange_phone = $this->request->param('phone','');
|
|
205
|
|
- if(!$exchange_phone || !preg_match("/^1[3456789]{1}\d{9}$/", $exchange_phone)){
|
|
206
|
|
- return app('json')->fail('请正确输入开通账号');
|
|
|
199
|
+ $decJingScore += $productDecJingdou;
|
|
207
|
200
|
}
|
|
208
|
|
- $ex_user=Db::name('user')->where('account',$exchange_phone)->find();
|
|
209
|
|
- if(!$ex_user){
|
|
210
|
|
- $userRepository = app()->make(UserRepository::class);
|
|
211
|
|
- $ex_user = $userRepository->registr($exchange_phone,'123456','APP',$uid);
|
|
212
|
|
- Db::name('user')->where('uid',$ex_user['uid'])->update(['spread_uid'=>$uid,'spread_time'=>date('Y-m-d H:i:s')]);
|
|
213
|
|
- }
|
|
214
|
|
- $enterprise_user_ex_user=Db::name('enterprise_user')->where('uid',$ex_user['uid'])-> where('mer_id',$this->merId)->find();
|
|
215
|
|
- if(!$enterprise_user_ex_user){
|
|
216
|
|
- $inset['uid']=$ex_user['uid'];
|
|
217
|
|
- $inset['mer_id']=$this->merId;
|
|
218
|
|
- $inset['puid']=$uid;
|
|
219
|
|
- $inset['node_uid']=$uid;
|
|
220
|
|
- Db::name('enterprise_user')->insert($inset);
|
|
221
|
|
- $enterprise_user_ex_user['identity']=0;
|
|
222
|
|
- }else if($enterprise_user_ex_user['node_uid']!=$uid){
|
|
223
|
|
- return app('json')->fail('红积分只能用于本人和直推用户使用');
|
|
224
|
|
- }
|
|
225
|
|
- if($enterprise_user_ex_user && in_array($enterprise_user_ex_user['identity'],[100,101,102,103,104,105])){
|
|
226
|
|
- return app('json')->fail('此用户已经是合伙人');
|
|
227
|
|
- }
|
|
228
|
|
-
|
|
229
|
|
-
|
|
230
|
201
|
}
|
|
|
202
|
+ if (!$decScore && !$decJingScore) {
|
|
|
203
|
+ return app('json')->fail('必须消耗京豆或积分');
|
|
|
204
|
+ }
|
|
|
205
|
+ $userInfo = Db::name('user')->where('uid', $uid)->find();
|
|
|
206
|
+ $haveScore = $userInfo['score'];
|
|
|
207
|
+ if ($haveScore < $decScore) {
|
|
|
208
|
+ return app('json')->fail('积分不足');
|
|
|
209
|
+ }
|
|
|
210
|
+ $haveJingScore = $userInfo['jingdou'];
|
|
|
211
|
+ if ($haveJingScore < $decJingScore) {
|
|
|
212
|
+ return app('json')->fail('京豆不足');
|
|
|
213
|
+ }
|
|
|
214
|
+
|
|
231
|
215
|
$cartIds=Db::name('store_cart')->where('cart_id','in',$cartId)->select()->toArray();
|
|
232
|
216
|
// $count=count($cartIds);
|
|
233
|
217
|
$product_id=explode('=',systemConfig('product_ids'));
|
|
|
@@ -431,7 +415,7 @@ class StoreOrder extends BaseController
|
|
431
|
415
|
|
|
432
|
416
|
makeLock()->lock();
|
|
433
|
417
|
try {
|
|
434
|
|
- $groupOrder = $this->repository->createOrder($this->request->userInfo(), array_search($payType, StoreOrderRepository::PAY_TYPE), $cartId, $addressId, $coupon, $take, $mark,$psType,$table_id,$share_id,$payType,$mer_id,$dacang_id,$distribution_mode,$ziti_address,$area_manage_address_ids,$youhui_price_key);
|
|
|
418
|
+ $groupOrder = $this->repository->createOrder($this->request->userInfo(), array_search($payType, StoreOrderRepository::PAY_TYPE), $cartId, $addressId, $coupon, $take, $mark,$psType,$table_id,$share_id,$payType,$mer_id,$dacang_id,$distribution_mode,$ziti_address,$area_manage_address_ids,$youhui_price_key,$cartIdAndPayTypMap);
|
|
435
|
419
|
} catch (\Throwable $e) {
|
|
436
|
420
|
makeLock()->unlock();
|
|
437
|
421
|
throw $e;
|
|
|
@@ -442,19 +426,19 @@ class StoreOrder extends BaseController
|
|
442
|
426
|
//删除缓存的优惠价格
|
|
443
|
427
|
Cache::delete($uid.'_youhui_price_'.$product_type_id);
|
|
444
|
428
|
|
|
445
|
|
- if($payType==5){
|
|
446
|
|
-
|
|
447
|
|
-
|
|
448
|
|
- $this->repository->integralPaySuccess($groupOrder,5);
|
|
449
|
|
- //积分商品
|
|
450
|
|
- $order_id=Db::name('store_order')->where('group_order_id',$groupOrder['group_order_id'])->value('order_id');
|
|
451
|
|
-
|
|
452
|
|
- $userRepository = app()->make(UserRepository::class);
|
|
453
|
|
- if ($special_merchant == "beishengtang"){
|
|
454
|
|
- $userRepository -> sign_add($uid,$price,1,'积分消费','','',$order_id,2,"store_order_beishengtang");
|
|
455
|
|
- }else{
|
|
456
|
|
- $userRepository -> sign_add($uid,$price*30,1,'积分消费','','',$order_id,2,'store_order');
|
|
457
|
|
- }
|
|
|
429
|
+// if($payType==5){
|
|
|
430
|
+//
|
|
|
431
|
+//
|
|
|
432
|
+// $this->repository->integralPaySuccess($groupOrder,5);
|
|
|
433
|
+// //积分商品
|
|
|
434
|
+// $order_id=Db::name('store_order')->where('group_order_id',$groupOrder['group_order_id'])->value('order_id');
|
|
|
435
|
+//
|
|
|
436
|
+// $userRepository = app()->make(UserRepository::class);
|
|
|
437
|
+// if ($special_merchant == "beishengtang"){
|
|
|
438
|
+// $userRepository -> sign_add($uid,$price,1,'积分消费','','',$order_id,2,"store_order_beishengtang");
|
|
|
439
|
+// }else{
|
|
|
440
|
+// $userRepository -> sign_add($uid,$price*30,1,'积分消费','','',$order_id,2,'store_order');
|
|
|
441
|
+// }
|
|
458
|
442
|
|
|
459
|
443
|
|
|
460
|
444
|
// Db::name('user') -> where('uid',$uid) -> dec('score', $price*30)->update();
|
|
|
@@ -496,67 +480,67 @@ class StoreOrder extends BaseController
|
|
496
|
480
|
// Db::name('entropy_barter_bill')->insert($insert);
|
|
497
|
481
|
return app('json')->status('success', '支付成功', ['order_id' => $groupOrder['group_order_id']]);
|
|
498
|
482
|
//
|
|
499
|
|
- }else if($payType==6){
|
|
500
|
|
- //积分商品
|
|
501
|
|
- $userRepository = app()->make(UserRepository::class);
|
|
502
|
|
- $order_id=Db::name('store_order')->where('group_order_id',$groupOrder['group_order_id'])->value('order_id');
|
|
503
|
|
- $hongjifen_kou=$userRepository -> sign_yhc_add($uid,$this->merId,$red_jifen,'兑换合伙人商品('.$ex_user['nickname'].')',$order_id,2,$ex_user['uid']);
|
|
504
|
|
- if(!$hongjifen_kou){
|
|
505
|
|
- return app('json')->fail('用户红积分不足,请刷新后再试');
|
|
506
|
|
- }
|
|
507
|
|
-
|
|
508
|
|
-
|
|
509
|
|
- Db::name('store_order')->where('group_order_id',$groupOrder['group_order_id'])->update(['exchange_phone'=>$exchange_phone]);
|
|
510
|
|
-
|
|
511
|
|
- $this->repository->integralPaySuccess($groupOrder,5);
|
|
512
|
|
-
|
|
513
|
|
-
|
|
514
|
|
- $enterprise_user=Db::name('enterprise_user')->where('uid',$ex_user['uid'])-> where('mer_id',$this->merId)->find();
|
|
515
|
|
- if($enterprise_user && $enterprise_user['identity']<100){ //不是合伙人就升级为合伙人
|
|
516
|
|
- Db::name('enterprise_user')->where('uid',$enterprise_user['uid'])->where('mer_id',$enterprise_user['mer_id'])->update(['identity'=>100,'exchange'=>100]);
|
|
517
|
|
- }
|
|
518
|
|
-
|
|
519
|
|
-
|
|
520
|
|
-
|
|
521
|
|
- $order=Db::name('store_order')->where('order_id',$order_id)->find();
|
|
522
|
|
- $store_order_product =Db::name('store_order_product')->where('order_id',$order_id)->where('type',17)->find();
|
|
523
|
|
- $cart_info=json_decode($store_order_product['cart_info'],true);
|
|
524
|
|
- $pay_price =$order['pay_price'];
|
|
525
|
|
- $unique=isset($cart_info['productAttr']['unique'])?$cart_info['productAttr']['unique']:'';
|
|
526
|
|
- $product_id=isset($cart_info['product']['product_id'])?$cart_info['product']['product_id']:'';
|
|
527
|
|
- if($unique){
|
|
528
|
|
- $store_product_attr_value=Db::name('store_product_attr_value')->where('unique',$unique)->find();
|
|
529
|
|
- }
|
|
530
|
|
- if($product_id && isset($store_product_attr_value)){
|
|
531
|
|
- $product_data=Db::name('store_product')->where('product_id',$product_id)->find();
|
|
532
|
|
- if($product_data && $product_data['pension_is']==1 && isset($store_product_attr_value['pension_num']) ){
|
|
533
|
|
- $member_settings['ylj']=$store_product_attr_value['pension_num'];//养老金比例单独设置
|
|
534
|
|
- }
|
|
535
|
|
-
|
|
536
|
|
- 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();
|
|
537
|
|
-
|
|
538
|
|
- }
|
|
539
|
|
-
|
|
540
|
|
-
|
|
541
|
|
- $user_yanglaojin=decimal2($member_settings['ylj']/100*$pay_price);//养老金 一壶茶会员商户从2后台设置比例
|
|
542
|
|
-
|
|
543
|
|
-
|
|
544
|
|
-
|
|
545
|
|
-
|
|
546
|
|
-
|
|
547
|
|
-
|
|
548
|
|
- $StoreOrderRepository = app()->make(StoreOrderRepository::class);
|
|
549
|
|
-
|
|
550
|
|
-
|
|
551
|
|
-
|
|
552
|
|
- if($user_yanglaojin>=0.01) {
|
|
553
|
|
- $order_sn=Db::name('store_order')->where('group_order_id',$groupOrder['group_order_id'])->value('order_sn');
|
|
554
|
|
- $StoreOrderRepository->add_bill_gongfu("养老金", $user_yanglaojin, $enterprise_user['uid'], "商城消费获得养老金" . $user_yanglaojin, 5, $order_sn, $order_id, $enterprise_user['mer_id'], 0, 0);
|
|
555
|
|
- }
|
|
556
|
|
-
|
|
557
|
|
-
|
|
558
|
|
- return app('json')->status('success', '支付成功', ['order_id' => $groupOrder['group_order_id']]);
|
|
559
|
|
- }
|
|
|
483
|
+// }else if($payType==6){
|
|
|
484
|
+// //积分商品
|
|
|
485
|
+// $userRepository = app()->make(UserRepository::class);
|
|
|
486
|
+// $order_id=Db::name('store_order')->where('group_order_id',$groupOrder['group_order_id'])->value('order_id');
|
|
|
487
|
+// $hongjifen_kou=$userRepository -> sign_yhc_add($uid,$this->merId,$red_jifen,'兑换合伙人商品('.$ex_user['nickname'].')',$order_id,2,$ex_user['uid']);
|
|
|
488
|
+// if(!$hongjifen_kou){
|
|
|
489
|
+// return app('json')->fail('用户红积分不足,请刷新后再试');
|
|
|
490
|
+// }
|
|
|
491
|
+//
|
|
|
492
|
+//
|
|
|
493
|
+// Db::name('store_order')->where('group_order_id',$groupOrder['group_order_id'])->update(['exchange_phone'=>$exchange_phone]);
|
|
|
494
|
+//
|
|
|
495
|
+// $this->repository->integralPaySuccess($groupOrder,5);
|
|
|
496
|
+//
|
|
|
497
|
+//
|
|
|
498
|
+// $enterprise_user=Db::name('enterprise_user')->where('uid',$ex_user['uid'])-> where('mer_id',$this->merId)->find();
|
|
|
499
|
+// if($enterprise_user && $enterprise_user['identity']<100){ //不是合伙人就升级为合伙人
|
|
|
500
|
+// Db::name('enterprise_user')->where('uid',$enterprise_user['uid'])->where('mer_id',$enterprise_user['mer_id'])->update(['identity'=>100,'exchange'=>100]);
|
|
|
501
|
+// }
|
|
|
502
|
+//
|
|
|
503
|
+//
|
|
|
504
|
+//
|
|
|
505
|
+// $order=Db::name('store_order')->where('order_id',$order_id)->find();
|
|
|
506
|
+// $store_order_product =Db::name('store_order_product')->where('order_id',$order_id)->where('type',17)->find();
|
|
|
507
|
+// $cart_info=json_decode($store_order_product['cart_info'],true);
|
|
|
508
|
+// $pay_price =$order['pay_price'];
|
|
|
509
|
+// $unique=isset($cart_info['productAttr']['unique'])?$cart_info['productAttr']['unique']:'';
|
|
|
510
|
+// $product_id=isset($cart_info['product']['product_id'])?$cart_info['product']['product_id']:'';
|
|
|
511
|
+// if($unique){
|
|
|
512
|
+// $store_product_attr_value=Db::name('store_product_attr_value')->where('unique',$unique)->find();
|
|
|
513
|
+// }
|
|
|
514
|
+// if($product_id && isset($store_product_attr_value)){
|
|
|
515
|
+// $product_data=Db::name('store_product')->where('product_id',$product_id)->find();
|
|
|
516
|
+// if($product_data && $product_data['pension_is']==1 && isset($store_product_attr_value['pension_num']) ){
|
|
|
517
|
+// $member_settings['ylj']=$store_product_attr_value['pension_num'];//养老金比例单独设置
|
|
|
518
|
+// }
|
|
|
519
|
+//
|
|
|
520
|
+// 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();
|
|
|
521
|
+//
|
|
|
522
|
+// }
|
|
|
523
|
+//
|
|
|
524
|
+//
|
|
|
525
|
+// $user_yanglaojin=decimal2($member_settings['ylj']/100*$pay_price);//养老金 一壶茶会员商户从2后台设置比例
|
|
|
526
|
+//
|
|
|
527
|
+//
|
|
|
528
|
+//
|
|
|
529
|
+//
|
|
|
530
|
+//
|
|
|
531
|
+//
|
|
|
532
|
+// $StoreOrderRepository = app()->make(StoreOrderRepository::class);
|
|
|
533
|
+//
|
|
|
534
|
+//
|
|
|
535
|
+//
|
|
|
536
|
+// if($user_yanglaojin>=0.01) {
|
|
|
537
|
+// $order_sn=Db::name('store_order')->where('group_order_id',$groupOrder['group_order_id'])->value('order_sn');
|
|
|
538
|
+// $StoreOrderRepository->add_bill_gongfu("养老金", $user_yanglaojin, $enterprise_user['uid'], "商城消费获得养老金" . $user_yanglaojin, 5, $order_sn, $order_id, $enterprise_user['mer_id'], 0, 0);
|
|
|
539
|
+// }
|
|
|
540
|
+//
|
|
|
541
|
+//
|
|
|
542
|
+// return app('json')->status('success', '支付成功', ['order_id' => $groupOrder['group_order_id']]);
|
|
|
543
|
+// }
|
|
560
|
544
|
if ($groupOrder['pay_price'] == 0) {
|
|
561
|
545
|
$this->repository->paySuccess($groupOrder);
|
|
562
|
546
|
return app('json')->status('success', '支付成功', ['order_id' => $groupOrder['group_order_id']]);
|