作者 jinglong
1 个管道 的构建 通过 耗费 6 秒

修改销量增加接口

@@ -37,6 +37,8 @@ class Bcoupon extends Backend @@ -37,6 +37,8 @@ class Bcoupon extends Backend
37 $arr[$value['id']] = $value['name'].'------'.$value['address']; 37 $arr[$value['id']] = $value['name'].'------'.$value['address'];
38 } 38 }
39 $this->assign('btype',$arr); 39 $this->assign('btype',$arr);
  40 +
  41 + $this->assign('gift',['无','分享人','被分享人']);
40 } 42 }
41 43
42 /** 44 /**
@@ -29,6 +29,7 @@ class Coupon extends Backend @@ -29,6 +29,7 @@ class Coupon extends Backend
29 $this->assign('r_type',['满减券','折扣券']); 29 $this->assign('r_type',['满减券','折扣券']);
30 $this->assign('coupon_type',['减少券','折扣券']); 30 $this->assign('coupon_type',['减少券','折扣券']);
31 $this->assign('is_new',['否','是']); 31 $this->assign('is_new',['否','是']);
  32 + $this->assign('gift',['无','分享人','被分享人']);
32 } 33 }
33 34
34 /** 35 /**
@@ -71,7 +72,7 @@ class Coupon extends Backend @@ -71,7 +72,7 @@ class Coupon extends Backend
71 ->select(); 72 ->select();
72 73
73 foreach ($list as $row) { 74 foreach ($list as $row) {
74 - $row->visible(['id','c_type','is_new','type','reduce','discount','coupon_number','createtime','coupon_type','end_time','coupon_name']); 75 + $row->visible(['id','c_type','is_new','gift','type','reduce','discount','coupon_number','createtime','coupon_type','end_time','coupon_name']);
75 76
76 } 77 }
77 $list = collection($list)->toArray(); 78 $list = collection($list)->toArray();
@@ -37,6 +37,8 @@ class Gcoupon extends Backend @@ -37,6 +37,8 @@ class Gcoupon extends Backend
37 $arr[$value['id']] = $value['name']; 37 $arr[$value['id']] = $value['name'];
38 } 38 }
39 $this->assign('goods',$arr); 39 $this->assign('goods',$arr);
  40 +
  41 + $this->assign('gift',['无','分享人','被分享人']);
40 } 42 }
41 43
42 /** 44 /**
@@ -5,6 +5,7 @@ return [ @@ -5,6 +5,7 @@ return [
5 'Bg_name' => '品牌名称', 5 'Bg_name' => '品牌名称',
6 'Bg_address' => '品牌产地', 6 'Bg_address' => '品牌产地',
7 'Is_new' => '新人专享', 7 'Is_new' => '新人专享',
  8 + 'Gift' => '分享礼包',
8 'Bg_id' => '品牌分类', 9 'Bg_id' => '品牌分类',
9 'Coupon_name' => '优惠券名称', 10 'Coupon_name' => '优惠券名称',
10 'C_type' => '优惠券类型', 11 'C_type' => '优惠券类型',
@@ -5,6 +5,7 @@ return [ @@ -5,6 +5,7 @@ return [
5 'C_type' => '优惠券类型', 5 'C_type' => '优惠券类型',
6 'Coupon_type' => '优惠类型', 6 'Coupon_type' => '优惠类型',
7 'Is_new' => '新人专享', 7 'Is_new' => '新人专享',
  8 + 'Gift' => '分享礼包',
8 'Full_reduce' => '满减金额', 9 'Full_reduce' => '满减金额',
9 'Coupon_name' => '优惠券名称', 10 'Coupon_name' => '优惠券名称',
10 'Reduce' => '减少金额', 11 'Reduce' => '减少金额',
@@ -5,6 +5,7 @@ return [ @@ -5,6 +5,7 @@ return [
5 'Goods' => '商品名称', 5 'Goods' => '商品名称',
6 'Bg_id' => '品牌分类', 6 'Bg_id' => '品牌分类',
7 'Is_new' => '新人专享', 7 'Is_new' => '新人专享',
  8 + 'Gift' => '分享礼包',
8 'C_type' => '优惠券类型', 9 'C_type' => '优惠券类型',
9 'Coupon_name' => '优惠券名称', 10 'Coupon_name' => '优惠券名称',
10 'Coupon_type' => '优惠类型', 11 'Coupon_type' => '优惠类型',
@@ -16,6 +16,9 @@ return [ @@ -16,6 +16,9 @@ return [
16 'Tag' => '商品标签', 16 'Tag' => '商品标签',
17 'Stock' => '商品库存', 17 'Stock' => '商品库存',
18 'Sort' => '排序', 18 'Sort' => '排序',
  19 + 'Hots' => '热度',
  20 + 'Sales' => '销售量',
  21 + 'Collections' => '收藏量',
19 'Introduce' => '商品简介', 22 'Introduce' => '商品简介',
20 'Detail' => '商品详情', 23 'Detail' => '商品详情',
21 'Createtime' => '创建时间', 24 'Createtime' => '创建时间',
@@ -16,6 +16,9 @@ return [ @@ -16,6 +16,9 @@ return [
16 'Tag' => '商品标签', 16 'Tag' => '商品标签',
17 'Stock' => '商品库存', 17 'Stock' => '商品库存',
18 'Sort' => '排序', 18 'Sort' => '排序',
  19 + 'Hots' => '热度',
  20 + 'Sales' => '销售量',
  21 + 'Collections' => '收藏量',
19 'Introduce' => '商品简介', 22 'Introduce' => '商品简介',
20 'Detail' => '商品详情', 23 'Detail' => '商品详情',
21 'Createtime' => '创建时间', 24 'Createtime' => '创建时间',
@@ -68,6 +68,12 @@ @@ -68,6 +68,12 @@
68 <input id="c-end_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value=""> 68 <input id="c-end_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="">
69 </div> 69 </div>
70 </div> 70 </div>
  71 + <div class="form-group">
  72 + <label class="control-label col-xs-12 col-sm-2">{:__('Gift')}:</label>
  73 + <div class="col-xs-12 col-sm-8">
  74 + {:build_select('row[gift]', $gift, null, ['class'=>'form-control', 'required'=>''])}
  75 + </div>
  76 + </div>
71 <div class="form-group layer-footer"> 77 <div class="form-group layer-footer">
72 <label class="control-label col-xs-12 col-sm-2"></label> 78 <label class="control-label col-xs-12 col-sm-2"></label>
73 <div class="col-xs-12 col-sm-8"> 79 <div class="col-xs-12 col-sm-8">
@@ -60,6 +60,12 @@ @@ -60,6 +60,12 @@
60 <input id="c-end_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="{$row.end_time|htmlentities}"> 60 <input id="c-end_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="{$row.end_time|htmlentities}">
61 </div> 61 </div>
62 </div> 62 </div>
  63 + <div class="form-group">
  64 + <label class="control-label col-xs-12 col-sm-2">{:__('Gift')}:</label>
  65 + <div class="col-xs-12 col-sm-8">
  66 + {:build_select('row[gift]', $gift, $row.gift, ['class'=>'form-control', 'required'=>''])}
  67 + </div>
  68 + </div>
63 <div class="form-group layer-footer"> 69 <div class="form-group layer-footer">
64 <label class="control-label col-xs-12 col-sm-2"></label> 70 <label class="control-label col-xs-12 col-sm-2"></label>
65 <div class="col-xs-12 col-sm-8"> 71 <div class="col-xs-12 col-sm-8">
@@ -62,6 +62,12 @@ @@ -62,6 +62,12 @@
62 <input id="c-end_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value=""> 62 <input id="c-end_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="">
63 </div> 63 </div>
64 </div> 64 </div>
  65 + <div class="form-group">
  66 + <label class="control-label col-xs-12 col-sm-2">{:__('Gift')}:</label>
  67 + <div class="col-xs-12 col-sm-8">
  68 + {:build_select('row[gift]', $gift, null, ['class'=>'form-control', 'required'=>''])}
  69 + </div>
  70 + </div>
65 <div class="form-group layer-footer"> 71 <div class="form-group layer-footer">
66 <label class="control-label col-xs-12 col-sm-2"></label> 72 <label class="control-label col-xs-12 col-sm-2"></label>
67 <div class="col-xs-12 col-sm-8"> 73 <div class="col-xs-12 col-sm-8">
@@ -54,6 +54,12 @@ @@ -54,6 +54,12 @@
54 <input id="c-end_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="{$row.end_time|htmlentities}"> 54 <input id="c-end_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="{$row.end_time|htmlentities}">
55 </div> 55 </div>
56 </div> 56 </div>
  57 + <div class="form-group">
  58 + <label class="control-label col-xs-12 col-sm-2">{:__('Gift')}:</label>
  59 + <div class="col-xs-12 col-sm-8">
  60 + {:build_select('row[gift]', $gift, $row.gift, ['class'=>'form-control', 'required'=>''])}
  61 + </div>
  62 + </div>
57 <div class="form-group layer-footer"> 63 <div class="form-group layer-footer">
58 <label class="control-label col-xs-12 col-sm-2"></label> 64 <label class="control-label col-xs-12 col-sm-2"></label>
59 <div class="col-xs-12 col-sm-8"> 65 <div class="col-xs-12 col-sm-8">
@@ -68,6 +68,12 @@ @@ -68,6 +68,12 @@
68 <input id="c-end_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value=""> 68 <input id="c-end_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="">
69 </div> 69 </div>
70 </div> 70 </div>
  71 + <div class="form-group">
  72 + <label class="control-label col-xs-12 col-sm-2">{:__('Gift')}:</label>
  73 + <div class="col-xs-12 col-sm-8">
  74 + {:build_select('row[gift]', $gift, null, ['class'=>'form-control', 'required'=>''])}
  75 + </div>
  76 + </div>
71 <div class="form-group layer-footer"> 77 <div class="form-group layer-footer">
72 <label class="control-label col-xs-12 col-sm-2"></label> 78 <label class="control-label col-xs-12 col-sm-2"></label>
73 <div class="col-xs-12 col-sm-8"> 79 <div class="col-xs-12 col-sm-8">
@@ -60,6 +60,12 @@ @@ -60,6 +60,12 @@
60 <input id="c-end_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="{$row.end_time|htmlentities}"> 60 <input id="c-end_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="{$row.end_time|htmlentities}">
61 </div> 61 </div>
62 </div> 62 </div>
  63 + <div class="form-group">
  64 + <label class="control-label col-xs-12 col-sm-2">{:__('Gift')}:</label>
  65 + <div class="col-xs-12 col-sm-8">
  66 + {:build_select('row[gift]', $gift, $row.gift, ['class'=>'form-control', 'required'=>''])}
  67 + </div>
  68 + </div>
63 <div class="form-group layer-footer"> 69 <div class="form-group layer-footer">
64 <label class="control-label col-xs-12 col-sm-2"></label> 70 <label class="control-label col-xs-12 col-sm-2"></label>
65 <div class="col-xs-12 col-sm-8"> 71 <div class="col-xs-12 col-sm-8">
@@ -53,12 +53,6 @@ @@ -53,12 +53,6 @@
53 </div> 53 </div>
54 </div> 54 </div>
55 <div class="form-group"> 55 <div class="form-group">
56 - <label class="control-label col-xs-12 col-sm-2">{:__('New_price')}:</label>  
57 - <div class="col-xs-12 col-sm-8">  
58 - <input id="c-new_price" class="form-control" step="0.01" name="row[new_price]" type="number" value="0.00">  
59 - </div>  
60 - </div>  
61 - <div class="form-group">  
62 <label class="control-label col-xs-12 col-sm-2">{:__('Sale_price')}:</label> 56 <label class="control-label col-xs-12 col-sm-2">{:__('Sale_price')}:</label>
63 <div class="col-xs-12 col-sm-8"> 57 <div class="col-xs-12 col-sm-8">
64 <input id="c-sale_price" class="form-control" step="0.01" name="row[sale_price]" type="number" value="0.00"> 58 <input id="c-sale_price" class="form-control" step="0.01" name="row[sale_price]" type="number" value="0.00">
@@ -53,12 +53,6 @@ @@ -53,12 +53,6 @@
53 </div> 53 </div>
54 </div> 54 </div>
55 <div class="form-group"> 55 <div class="form-group">
56 - <label class="control-label col-xs-12 col-sm-2">{:__('New_price')}:</label>  
57 - <div class="col-xs-12 col-sm-8">  
58 - <input id="c-new_price" class="form-control" step="0.01" name="row[new_price]" type="number" value="{$row.new_price|htmlentities}">  
59 - </div>  
60 - </div>  
61 - <div class="form-group">  
62 <label class="control-label col-xs-12 col-sm-2">{:__('Sale_price')}:</label> 56 <label class="control-label col-xs-12 col-sm-2">{:__('Sale_price')}:</label>
63 <div class="col-xs-12 col-sm-8"> 57 <div class="col-xs-12 col-sm-8">
64 <input id="c-sale_price" class="form-control" step="0.01" name="row[sale_price]" type="number" value="{$row.sale_price|htmlentities}"> 58 <input id="c-sale_price" class="form-control" step="0.01" name="row[sale_price]" type="number" value="{$row.sale_price|htmlentities}">
@@ -53,12 +53,6 @@ @@ -53,12 +53,6 @@
53 </div> 53 </div>
54 </div> 54 </div>
55 <div class="form-group"> 55 <div class="form-group">
56 - <label class="control-label col-xs-12 col-sm-2">{:__('New_price')}:</label>  
57 - <div class="col-xs-12 col-sm-8">  
58 - <input id="c-new_price" class="form-control" step="0.01" name="row[new_price]" type="number" value="0.00">  
59 - </div>  
60 - </div>  
61 - <div class="form-group">  
62 <label class="control-label col-xs-12 col-sm-2">{:__('Sale_price')}:</label> 56 <label class="control-label col-xs-12 col-sm-2">{:__('Sale_price')}:</label>
63 <div class="col-xs-12 col-sm-8"> 57 <div class="col-xs-12 col-sm-8">
64 <input id="c-sale_price" class="form-control" step="0.01" name="row[sale_price]" type="number" value="0.00"> 58 <input id="c-sale_price" class="form-control" step="0.01" name="row[sale_price]" type="number" value="0.00">
@@ -53,12 +53,6 @@ @@ -53,12 +53,6 @@
53 </div> 53 </div>
54 </div> 54 </div>
55 <div class="form-group"> 55 <div class="form-group">
56 - <label class="control-label col-xs-12 col-sm-2">{:__('New_price')}:</label>  
57 - <div class="col-xs-12 col-sm-8">  
58 - <input id="c-new_price" class="form-control" step="0.01" name="row[new_price]" type="number" value="{$row.new_price|htmlentities}">  
59 - </div>  
60 - </div>  
61 - <div class="form-group">  
62 <label class="control-label col-xs-12 col-sm-2">{:__('Sale_price')}:</label> 56 <label class="control-label col-xs-12 col-sm-2">{:__('Sale_price')}:</label>
63 <div class="col-xs-12 col-sm-8"> 57 <div class="col-xs-12 col-sm-8">
64 <input id="c-sale_price" class="form-control" step="0.01" name="row[sale_price]" type="number" value="{$row.sale_price|htmlentities}"> 58 <input id="c-sale_price" class="form-control" step="0.01" name="row[sale_price]" type="number" value="{$row.sale_price|htmlentities}">
@@ -486,4 +486,19 @@ class Common @@ -486,4 +486,19 @@ class Common
486 $rCouponModel = new Rcoupon(); 486 $rCouponModel = new Rcoupon();
487 $rCouponModel->where(['uid'=>$uid,'c_id'=>$coupon_id])->update(['is_use'=>$is_use]); 487 $rCouponModel->where(['uid'=>$uid,'c_id'=>$coupon_id])->update(['is_use'=>$is_use]);
488 } 488 }
  489 +
  490 + /**
  491 + * 购买成功,更新订单号,销量增加1
  492 + * @ApiInternal
  493 + */
  494 + public static function incSales($out_trade_no){
  495 + $status = config('verify.status');
  496 + //更新订单号成功
  497 + $orderModel = new Order();
  498 + $orderModel->where(['pay_order_sn'=>$out_trade_no,'status'=>$status[0]])->update(['status'=>$status[2]]);
  499 + $goodsModel = new \app\admin\model\Goods();
  500 + //销量增加1
  501 + $res = self::findSoftWhereData('order',['pay_order_sn'=>$out_trade_no,'status'=>$status[2]],'id');
  502 + $goodsModel->where(['id'=>$res['id']])->setInc('sales',1);
  503 + }
489 } 504 }
@@ -112,10 +112,8 @@ class Pay extends Api @@ -112,10 +112,8 @@ class Pay extends Api
112 if ($message['return_code'] === 'SUCCESS') { 112 if ($message['return_code'] === 'SUCCESS') {
113 113
114 if ($message['result_code'] === 'SUCCESS') { 114 if ($message['result_code'] === 'SUCCESS') {
115 - //支付成功,更新订单状态  
116 - $status = $this->order_status;  
117 - $orderModel = new Order();  
118 - $orderModel->where(['pay_order_sn'=>$message['out_trade_no'],'status'=>$status[0]])->update(['status'=>$status[2]]); 115 + //支付成功,更新订单号,销量增加1
  116 + Common::incSales($message['out_trade_no']);
119 }elseif($message['result_code'] === 'FAIL') { 117 }elseif($message['result_code'] === 'FAIL') {
120 //支付失败 118 //支付失败
121 } 119 }
@@ -220,10 +218,8 @@ class Pay extends Api @@ -220,10 +218,8 @@ class Pay extends Api
220 //return_code 表示通信状态 218 //return_code 表示通信状态
221 if ($message['return_code'] === 'SUCCESS') { 219 if ($message['return_code'] === 'SUCCESS') {
222 if ($message['result_code'] === 'SUCCESS') { 220 if ($message['result_code'] === 'SUCCESS') {
223 - //支付成功  
224 - $status = $this->order_status;  
225 - $orderModel = new Order();  
226 - $orderModel->where(['pay_order_sn'=>$message['out_trade_no'],'status'=>$status[0]])->update(['status'=>$status[2]]); 221 + //支付成功,更新订单号,销量增加1
  222 + Common::incSales($message['out_trade_no']);
227 }elseif($message['result_code'] === 'FAIL') { 223 }elseif($message['result_code'] === 'FAIL') {
228 //支付失败,好像有问题 224 //支付失败,好像有问题
229 } 225 }
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace app\api\controller; 3 namespace app\api\controller;
4 4
5 use app\admin\model\Collection; 5 use app\admin\model\Collection;
  6 +use app\admin\model\Rcoupon;
6 use app\common\controller\Api; 7 use app\common\controller\Api;
7 use fast\Http; 8 use fast\Http;
8 use think\Validate; 9 use think\Validate;
@@ -215,6 +216,8 @@ class User extends Api @@ -215,6 +216,8 @@ class User extends Api
215 }else{ 216 }else{
216 $res = $collectionModel->create(['g_id'=>$goods_id,'uid'=>$this->uid]); 217 $res = $collectionModel->create(['g_id'=>$goods_id,'uid'=>$this->uid]);
217 if($res){ 218 if($res){
  219 + $goodsModel = new \app\admin\model\Goods();
  220 + $goodsModel->where(['id'=>$goods_id])->setInc('collections',1);
218 $this->success('成功'); 221 $this->success('成功');
219 }else{ 222 }else{
220 $this->error('失败'); 223 $this->error('失败');
@@ -252,6 +255,8 @@ class User extends Api @@ -252,6 +255,8 @@ class User extends Api
252 $collectionModel = new Collection(); 255 $collectionModel = new Collection();
253 $res = $collectionModel->where(['uid'=>$this->uid,'g_id'=>$goods_id])->delete(); 256 $res = $collectionModel->where(['uid'=>$this->uid,'g_id'=>$goods_id])->delete();
254 if($res){ 257 if($res){
  258 + $goodsModel = new \app\admin\model\Goods();
  259 + $goodsModel->where(['id'=>$goods_id])->setDec('collections',1);
255 $this->success('成功'); 260 $this->success('成功');
256 }else{ 261 }else{
257 $this->error('失败'); 262 $this->error('失败');
@@ -449,4 +454,65 @@ class User extends Api @@ -449,4 +454,65 @@ class User extends Api
449 $this->error('请求方式错误'); 454 $this->error('请求方式错误');
450 } 455 }
451 } 456 }
  457 +
  458 + /**
  459 + * @ApiTitle (分享获取礼包)
  460 + * @ApiSummary (分享获取礼包)
  461 + * @ApiMethod (POST)
  462 + * @ApiRoute (/api/user/share)
  463 + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
  464 + *
  465 + * @ApiParams (name="share_uid", type="inter", required=true, description="分享人uid")
  466 + *
  467 + * @ApiReturn({
  468 + "code": 1,
  469 + "msg": "成功",
  470 + "time": "1571037179",
  471 + "data": null
  472 + })
  473 + */
  474 + public function share(){
  475 + if($this->request->isPost()){
  476 + $share_uid = $this->request->post('share_uid');
  477 + $rule = config('verify.share');
  478 + $validate = new Validate($rule['rule'],$rule['msg']);
  479 + if (!$validate->check(['share_uid'=>$share_uid])) {
  480 + $this->error($validate->getError());
  481 + }
  482 +
  483 + $rCouponModel = new Rcoupon();
  484 + //查询分享人已领取优惠券
  485 + $receive = Common::selectWhereData('rcoupon',['uid'=>$share_uid],'id,c_id');
  486 + $receive_s = array_column($receive,'c_id');
  487 + //查询分享人优惠券
  488 + $res_coupon = Common::selectWhereData('coupon',['gift'=>1,'end_time'=>['>',time()]],'id');
  489 + $res_coupon = array_column($res_coupon,'id');
  490 + $res = array_diff($res_coupon,$receive_s);//数组1不存在数组2中的数组
  491 + $arr = [];
  492 + foreach($res as $key=>$value){
  493 + $arr[$key]['uid'] = $share_uid;
  494 + $arr[$key]['c_id'] = $value;
  495 + $arr[$key]['is_share'] = 1;
  496 + }
  497 + $rCouponModel->saveAll($arr);
  498 +
  499 + //查询被分享人已领取优惠券
  500 + $receive = Common::selectWhereData('rcoupon',['uid'=>$this->uid],'id,c_id');
  501 + $receive_s = array_column($receive,'c_id');
  502 + //查询分享人优惠券
  503 + $res_coupon = Common::selectWhereData('coupon',['gift'=>2,'end_time'=>['>',time()]],'id');
  504 + $res_coupon = array_column($res_coupon,'id');
  505 + $res = array_diff($res_coupon,$receive_s);//数组1不存在数组2中的数组
  506 + $arr1 = [];
  507 + foreach($res as $key=>$value){
  508 + $arr1[$key]['uid'] = $this->uid;
  509 + $arr1[$key]['c_id'] = $value;
  510 + $arr1[$key]['is_share'] = 1;
  511 + }
  512 + $rCouponModel->saveAll($arr1);
  513 + $this->success('成功');
  514 + }else{
  515 + $this->error('请求方式错误');
  516 + }
  517 + }
452 } 518 }
@@ -7,8 +7,8 @@ return [ @@ -7,8 +7,8 @@ return [
7 ], 7 ],
8 //快递鸟配置 8 //快递鸟配置
9 'express'=>[ 9 'express'=>[
10 - 'EBusinessID' =>'1442433',  
11 - 'appKey' =>'59387773-4d1c-4006-a5c6-159261ed4fef', 10 + 'EBusinessID' =>'1576495',
  11 + 'appKey' =>'a504b6fa-f6a1-4de0-82f1-fd6d7b4927a5',
12 'url' =>'http://api.kdniao.com/Ebusiness/EbusinessOrderHandle.aspx',//请求地址 12 'url' =>'http://api.kdniao.com/Ebusiness/EbusinessOrderHandle.aspx',//请求地址
13 ], 13 ],
14 //微信支付配置 14 //微信支付配置
@@ -306,4 +306,14 @@ return [ @@ -306,4 +306,14 @@ return [
306 'return_reason.require' => '退货/换货原因不能为空', 306 'return_reason.require' => '退货/换货原因不能为空',
307 ] 307 ]
308 ], 308 ],
  309 + //分享
  310 + 'share' => [
  311 + 'rule' => [
  312 + 'share_uid' => 'require|number',
  313 + ],
  314 + 'msg' => [
  315 + 'share_uid.require' => '分享人id不能为空',
  316 + 'share_uid.number' => '分享人id必须为数字',
  317 + ]
  318 + ],
309 ]; 319 ];
@@ -222,6 +222,7 @@ @@ -222,6 +222,7 @@
222 <a href="javascript:;" data-id="42" class="list-group-item">取消收藏</a> 222 <a href="javascript:;" data-id="42" class="list-group-item">取消收藏</a>
223 <a href="javascript:;" data-id="43" class="list-group-item">我的收藏</a> 223 <a href="javascript:;" data-id="43" class="list-group-item">我的收藏</a>
224 <a href="javascript:;" data-id="44" class="list-group-item">我的优惠券</a> 224 <a href="javascript:;" data-id="44" class="list-group-item">我的优惠券</a>
  225 + <a href="javascript:;" data-id="45" class="list-group-item">分享获取礼包</a>
225 </div> 226 </div>
226 </div> 227 </div>
227 </div> 228 </div>
@@ -7121,13 +7122,156 @@ @@ -7121,13 +7122,156 @@
7121 </div> 7122 </div>
7122 </div> 7123 </div>
7123 </div> 7124 </div>
  7125 + <div class="panel panel-default">
  7126 + <div class="panel-heading" id="heading-45">
  7127 + <h4 class="panel-title">
  7128 + <span class="label label-primary">POST</span>
  7129 + <a data-toggle="collapse" data-parent="#accordion45" href="#collapseOne45"> 分享获取礼包 <span class="text-muted">/api/user/share</span></a>
  7130 + </h4>
  7131 + </div>
  7132 + <div id="collapseOne45" class="panel-collapse collapse">
  7133 + <div class="panel-body">
  7134 +
  7135 + <!-- Nav tabs -->
  7136 + <ul class="nav nav-tabs" id="doctab45">
  7137 + <li class="active"><a href="#info45" data-toggle="tab">基础信息</a></li>
  7138 + <li><a href="#sandbox45" data-toggle="tab">在线测试</a></li>
  7139 + <li><a href="#sample45" data-toggle="tab">返回示例</a></li>
  7140 + </ul>
  7141 +
  7142 + <!-- Tab panes -->
  7143 + <div class="tab-content">
  7144 +
  7145 + <div class="tab-pane active" id="info45">
  7146 + <div class="well">
  7147 + 分享获取礼包 </div>
  7148 + <div class="panel panel-default">
  7149 + <div class="panel-heading"><strong>Headers</strong></div>
  7150 + <div class="panel-body">
  7151 + <table class="table table-hover">
  7152 + <thead>
  7153 + <tr>
  7154 + <th>名称</th>
  7155 + <th>类型</th>
  7156 + <th>必选</th>
  7157 + <th>描述</th>
  7158 + </tr>
  7159 + </thead>
  7160 + <tbody>
  7161 + <tr>
  7162 + <td>token</td>
  7163 + <td>string</td>
  7164 + <td></td>
  7165 + <td>请求的Token</td>
  7166 + </tr>
  7167 + </tbody>
  7168 + </table>
  7169 + </div>
  7170 + </div>
  7171 + <div class="panel panel-default">
  7172 + <div class="panel-heading"><strong>参数</strong></div>
  7173 + <div class="panel-body">
  7174 + <table class="table table-hover">
  7175 + <thead>
  7176 + <tr>
  7177 + <th>名称</th>
  7178 + <th>类型</th>
  7179 + <th>必选</th>
  7180 + <th>描述</th>
  7181 + </tr>
  7182 + </thead>
  7183 + <tbody>
  7184 + <tr>
  7185 + <td>share_uid</td>
  7186 + <td>inter</td>
  7187 + <td></td>
  7188 + <td>分享人uid</td>
  7189 + </tr>
  7190 + </tbody>
  7191 + </table>
  7192 + </div>
  7193 + </div>
  7194 + <div class="panel panel-default">
  7195 + <div class="panel-heading"><strong>正文</strong></div>
  7196 + <div class="panel-body">
  7197 +</div>
  7198 + </div>
  7199 + </div><!-- #info -->
  7200 +
  7201 + <div class="tab-pane" id="sandbox45">
  7202 + <div class="row">
  7203 + <div class="col-md-12">
  7204 + <div class="panel panel-default">
  7205 + <div class="panel-heading"><strong>Headers</strong></div>
  7206 + <div class="panel-body">
  7207 + <div class="headers">
  7208 + <div class="form-group">
  7209 + <label class="control-label" for="token">token</label>
  7210 + <input type="string" class="form-control input-sm" id="token" required placeholder="请求的Token - Ex: " name="token">
  7211 + </div>
  7212 + </div>
  7213 + </div>
  7214 + </div>
  7215 + <div class="panel panel-default">
  7216 + <div class="panel-heading"><strong>参数</strong></div>
  7217 + <div class="panel-body">
  7218 + <form enctype="application/x-www-form-urlencoded" role="form" action="/api/user/share" method="POST" name="form45" id="form45">
  7219 + <div class="form-group">
  7220 + <label class="control-label" for="share_uid">share_uid</label>
  7221 + <input type="inter" class="form-control input-sm" id="share_uid" required placeholder="分享人uid" name="share_uid">
  7222 + </div>
  7223 + <div class="form-group">
  7224 + <button type="submit" class="btn btn-success send" rel="45">提交</button>
  7225 + <button type="reset" class="btn btn-info" rel="45">重置</button>
  7226 + </div>
  7227 + </form>
  7228 + </div>
  7229 + </div>
  7230 + <div class="panel panel-default">
  7231 + <div class="panel-heading"><strong>响应输出</strong></div>
  7232 + <div class="panel-body">
  7233 + <div class="row">
  7234 + <div class="col-md-12" style="overflow-x:auto">
  7235 + <pre id="response_headers45"></pre>
  7236 + <pre id="response45"></pre>
  7237 + </div>
  7238 + </div>
  7239 + </div>
  7240 + </div>
  7241 + <div class="panel panel-default">
  7242 + <div class="panel-heading"><strong>返回参数</strong></div>
  7243 + <div class="panel-body">
  7244 +
  7245 + </div>
  7246 + </div>
  7247 + </div>
  7248 + </div>
  7249 + </div><!-- #sandbox -->
  7250 +
  7251 + <div class="tab-pane" id="sample45">
  7252 + <div class="row">
  7253 + <div class="col-md-12">
  7254 + <pre id="sample_response45">{
  7255 + "code": 1,
  7256 + "msg": "成功",
  7257 + "time": "1571037179",
  7258 + "data": null
  7259 + }</pre>
  7260 + </div>
  7261 + </div>
  7262 + </div><!-- #sample -->
  7263 +
  7264 + </div><!-- .tab-content -->
  7265 + </div>
  7266 + </div>
  7267 + </div>
7124 </div> 7268 </div>
7125 7269
7126 <hr> 7270 <hr>
7127 7271
7128 <div class="row mt0 footer"> 7272 <div class="row mt0 footer">
7129 <div class="col-md-6" align="left"> 7273 <div class="col-md-6" align="left">
7130 - Generated on 2019-12-05 17:14:02 </div> 7274 + Generated on 2019-12-05 19:38:12 </div>
7131 <div class="col-md-6" align="right"> 7275 <div class="col-md-6" align="right">
7132 <a href="https://www.fastadmin.net" target="_blank">FastAdmin</a> 7276 <a href="https://www.fastadmin.net" target="_blank">FastAdmin</a>
7133 </div> 7277 </div>
@@ -74,6 +74,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -74,6 +74,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
74 {field: 'coupon_number', title: __('coupon_number')}, 74 {field: 'coupon_number', title: __('coupon_number')},
75 {field: 'is_new', title: __('Is_new'),formatter: Table.api.formatter.label,searchList: {0: __('否'), 1: __('是')}}, 75 {field: 'is_new', title: __('Is_new'),formatter: Table.api.formatter.label,searchList: {0: __('否'), 1: __('是')}},
76 {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, 76 {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  77 + {field: 'gift', title: __('Gift'),formatter: Table.api.formatter.label,searchList: {0: __('无'), 1: __('分享人'),2:__('被分享人')}},
77 {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, 78 {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
78 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} 79 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
79 ] 80 ]
@@ -72,6 +72,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -72,6 +72,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
72 {field: 'coupon_number', title: __('Coupon_number')}, 72 {field: 'coupon_number', title: __('Coupon_number')},
73 {field: 'is_new', title: __('Is_new'),formatter: Table.api.formatter.label,searchList: {0: __('否'), 1: __('是')}}, 73 {field: 'is_new', title: __('Is_new'),formatter: Table.api.formatter.label,searchList: {0: __('否'), 1: __('是')}},
74 {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, 74 {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  75 + {field: 'gift', title: __('Gift'),formatter: Table.api.formatter.label,searchList: {0: __('无'), 1: __('分享人'),2:__('被分享人')}},
75 {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, 76 {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
76 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} 77 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
77 ] 78 ]
@@ -73,6 +73,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -73,6 +73,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
73 {field: 'coupon_number', title: __('coupon_number')}, 73 {field: 'coupon_number', title: __('coupon_number')},
74 {field: 'is_new', title: __('Is_new'),formatter: Table.api.formatter.label,searchList: {0: __('否'), 1: __('是')}}, 74 {field: 'is_new', title: __('Is_new'),formatter: Table.api.formatter.label,searchList: {0: __('否'), 1: __('是')}},
75 {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, 75 {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  76 + {field: 'gift', title: __('Gift'),formatter: Table.api.formatter.label,searchList: {0: __('无'), 1: __('分享人'),2:__('被分享人')}},
76 {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, 77 {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
77 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} 78 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
78 ] 79 ]
@@ -53,6 +53,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -53,6 +53,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
53 {field: 'market_price', title: __('Market_price'), operate:'BETWEEN'},//市场价格 53 {field: 'market_price', title: __('Market_price'), operate:'BETWEEN'},//市场价格
54 {field: 'expense_price', title: __('Expense_price'), operate:'BETWEEN'},//运费 54 {field: 'expense_price', title: __('Expense_price'), operate:'BETWEEN'},//运费
55 {field: 'sort', title: __('Sort')},//排序 55 {field: 'sort', title: __('Sort')},//排序
  56 + {field: 'sort', title: __('Sort')},//排序
  57 + {field: 'hots', title: __('Hots')},//浏览量
  58 + {field: 'sales', title: __('Sales')},//销量
  59 + {field: 'collections', title: __('Collections')},//收藏量
56 {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, 60 {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
57 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} 61 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
58 ] 62 ]
@@ -54,6 +54,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -54,6 +54,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
54 {field: 'market_price', title: __('Market_price'), operate:'BETWEEN'},//市场价格 54 {field: 'market_price', title: __('Market_price'), operate:'BETWEEN'},//市场价格
55 {field: 'expense_price', title: __('Expense_price'), operate:'BETWEEN'},//运费 55 {field: 'expense_price', title: __('Expense_price'), operate:'BETWEEN'},//运费
56 {field: 'sort', title: __('Sort')},//排序 56 {field: 'sort', title: __('Sort')},//排序
  57 + {field: 'hots', title: __('Hots')},//浏览量
  58 + {field: 'sales', title: __('Sales')},//销量
  59 + {field: 'collections', title: __('Collections')},//收藏量
57 {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, 60 {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
58 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} 61 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
59 ] 62 ]