正在显示
6 个修改的文件
包含
56 行增加
和
4 行删除
@@ -29,7 +29,37 @@ class Store extends Backend | @@ -29,7 +29,37 @@ class Store extends Backend | ||
29 | 29 | ||
30 | } | 30 | } |
31 | 31 | ||
32 | + /** | ||
33 | + * 查看 | ||
34 | + * | ||
35 | + * @return string|Json | ||
36 | + * @throws \think\Exception | ||
37 | + * @throws DbException | ||
38 | + */ | ||
39 | + public function index() | ||
40 | + { | ||
41 | + //设置过滤方法 | ||
42 | + $this->request->filter(['strip_tags', 'trim']); | ||
43 | + if (false === $this->request->isAjax()) { | ||
44 | + return $this->view->fetch(); | ||
45 | + } | ||
46 | + //如果发送的来源是 Selectpage,则转发到 Selectpage | ||
47 | + if ($this->request->request('keyField')) { | ||
48 | + return $this->selectpage(); | ||
49 | + } | ||
50 | + [$where, $sort, $order, $offset, $limit] = $this->buildparams(); | ||
51 | + $list = $this->model | ||
52 | + ->where($where) | ||
53 | + ->order($sort, $order) | ||
54 | + ->paginate($limit); | ||
32 | 55 | ||
56 | + foreach ($list as $row) { | ||
57 | + | ||
58 | + } | ||
59 | + | ||
60 | + $result = ['total' => $list->total(), 'rows' => $list->items()]; | ||
61 | + return json($result); | ||
62 | + } | ||
33 | 63 | ||
34 | /** | 64 | /** |
35 | * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 | 65 | * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 |
@@ -37,6 +37,12 @@ | @@ -37,6 +37,12 @@ | ||
37 | </div> | 37 | </div> |
38 | </div> | 38 | </div> |
39 | <div class="form-group"> | 39 | <div class="form-group"> |
40 | + <label class="control-label col-xs-12 col-sm-2">{:__('Verification_coupon_id')}:</label> | ||
41 | + <div class="col-xs-12 col-sm-8"> | ||
42 | + <input id="c-cerification_coupon_id" data-rule="required" data-source="verification/coupon/index" class="form-control selectpage" name="row[verification_coupon_id]" type="text" value=""> | ||
43 | + </div> | ||
44 | + </div> | ||
45 | + <div class="form-group"> | ||
40 | <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label> | 46 | <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label> |
41 | <div class="col-xs-12 col-sm-8"> | 47 | <div class="col-xs-12 col-sm-8"> |
42 | <div class="input-group"> | 48 | <div class="input-group"> |
@@ -37,6 +37,12 @@ | @@ -37,6 +37,12 @@ | ||
37 | </div> | 37 | </div> |
38 | </div> | 38 | </div> |
39 | <div class="form-group"> | 39 | <div class="form-group"> |
40 | + <label class="control-label col-xs-12 col-sm-2">{:__('Verification_coupon_id')}:</label> | ||
41 | + <div class="col-xs-12 col-sm-8"> | ||
42 | + <input id="c-cerification_coupon_id" data-rule="required" data-source="verification/coupon/index" class="form-control selectpage" name="row[verification_coupon_id]" type="text" value="{$row.verification_coupon_id|htmlentities}"> | ||
43 | + </div> | ||
44 | + </div> | ||
45 | + <div class="form-group"> | ||
40 | <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label> | 46 | <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label> |
41 | <div class="col-xs-12 col-sm-8"> | 47 | <div class="col-xs-12 col-sm-8"> |
42 | <div class="input-group"> | 48 | <div class="input-group"> |
@@ -380,11 +380,13 @@ class Wechat extends Api | @@ -380,11 +380,13 @@ class Wechat extends Api | ||
380 | public function sales_distribution($order_info=[]){ | 380 | public function sales_distribution($order_info=[]){ |
381 | //测试 | 381 | //测试 |
382 | //$order_info = Db::name('verification_order')->where("id='14'")->find(); | 382 | //$order_info = Db::name('verification_order')->where("id='14'")->find(); |
383 | - | 383 | + $time = time(); |
384 | if(empty($order_info)){ return $this->error('订单信息不存在');} | 384 | if(empty($order_info)){ return $this->error('订单信息不存在');} |
385 | $w['id'] = $order_info['user_id']; | 385 | $w['id'] = $order_info['user_id']; |
386 | $myInfo = Db::name('user')->where($w)->find(); | 386 | $myInfo = Db::name('user')->where($w)->find(); |
387 | - //是否与上级 | 387 | + //支付成功 自己领券 |
388 | + $this->send_voucher($order_info['user_id'],$order_info['verification_coupon_ids'],$order_info['id'],$time); | ||
389 | + //是否有上级 | ||
388 | if(!empty($myInfo['pid'])){ | 390 | if(!empty($myInfo['pid'])){ |
389 | //上级 | 391 | //上级 |
390 | try{ | 392 | try{ |
@@ -418,11 +420,17 @@ class Wechat extends Api | @@ -418,11 +420,17 @@ class Wechat extends Api | ||
418 | //属于代理 发送红包 | 420 | //属于代理 发送红包 |
419 | $this->grant_red_packets($pid,$order_id); | 421 | $this->grant_red_packets($pid,$order_id); |
420 | }else{ | 422 | }else{ |
421 | - //属于普通用户 发送代金券 | ||
422 | - $this->send_voucher($pid,$verification_coupon_ids,$order_id,$time); | 423 | + //属于普通用户 则领取礼品券 |
424 | + $this->send_gift_certificate($pid,$verification_coupon_ids,$order_id,$time); | ||
423 | } | 425 | } |
424 | } | 426 | } |
425 | 427 | ||
428 | + //发放 对应活动的礼品券 | ||
429 | + public function send_gift_certificate($pid,$verification_coupon_ids,$order_id,$time){ | ||
430 | + $w1 = []; | ||
431 | + $w1['id'] = ['in',$verification_coupon_ids]; | ||
432 | + $coupon = Db::name('verification_coupon')->where($w1)->select(); | ||
433 | + } | ||
426 | //发放 对应活动包含的券 | 434 | //发放 对应活动包含的券 |
427 | public function send_voucher($pid,$verification_coupon_ids,$order_id,$time){ | 435 | public function send_voucher($pid,$verification_coupon_ids,$order_id,$time){ |
428 | $w1 = []; | 436 | $w1 = []; |
@@ -32,6 +32,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -32,6 +32,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
32 | {field: 'commission', title: __('Commission'), operate: 'LIKE'}, | 32 | {field: 'commission', title: __('Commission'), operate: 'LIKE'}, |
33 | {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, | 33 | {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, |
34 | {field: 'agent_image', title: __('Agent_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, | 34 | {field: 'agent_image', title: __('Agent_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, |
35 | + {field: 'coupon.name', title: __('Verification_coupon_id'), operate: 'LIKE'}, | ||
35 | {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate, | 36 | {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate, |
36 | buttons:[ | 37 | buttons:[ |
37 | 38 |
-
请 注册 或 登录 后发表评论