作者 chencheng

0601-8

... ... @@ -29,7 +29,37 @@ class Store extends Backend
}
/**
* 查看
*
* @return string|Json
* @throws \think\Exception
* @throws DbException
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage,则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
}
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
... ...
... ... @@ -9,5 +9,6 @@ return [
'Lng' => '经度',
'Agent_image' => '代理人邀请二维码',
'Phone' => '联系电话',
'Verification_coupon_id' => '优惠券',
'Image' => '门店图片'
];
... ...
... ... @@ -37,6 +37,12 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Verification_coupon_id')}:</label>
<div class="col-xs-12 col-sm-8">
<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="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
... ...
... ... @@ -37,6 +37,12 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Verification_coupon_id')}:</label>
<div class="col-xs-12 col-sm-8">
<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}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
... ...
... ... @@ -380,11 +380,13 @@ class Wechat extends Api
public function sales_distribution($order_info=[]){
//测试
//$order_info = Db::name('verification_order')->where("id='14'")->find();
$time = time();
if(empty($order_info)){ return $this->error('订单信息不存在');}
$w['id'] = $order_info['user_id'];
$myInfo = Db::name('user')->where($w)->find();
//是否与上级
//支付成功 自己领券
$this->send_voucher($order_info['user_id'],$order_info['verification_coupon_ids'],$order_info['id'],$time);
//是否有上级
if(!empty($myInfo['pid'])){
//上级
try{
... ... @@ -418,11 +420,17 @@ class Wechat extends Api
//属于代理 发送红包
$this->grant_red_packets($pid,$order_id);
}else{
//属于普通用户 发送代金券
$this->send_voucher($pid,$verification_coupon_ids,$order_id,$time);
//属于普通用户 则领取礼品券
$this->send_gift_certificate($pid,$verification_coupon_ids,$order_id,$time);
}
}
//发放 对应活动的礼品券
public function send_gift_certificate($pid,$verification_coupon_ids,$order_id,$time){
$w1 = [];
$w1['id'] = ['in',$verification_coupon_ids];
$coupon = Db::name('verification_coupon')->where($w1)->select();
}
//发放 对应活动包含的券
public function send_voucher($pid,$verification_coupon_ids,$order_id,$time){
$w1 = [];
... ...
... ... @@ -32,6 +32,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'commission', title: __('Commission'), operate: 'LIKE'},
{field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'agent_image', title: __('Agent_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'coupon.name', title: __('Verification_coupon_id'), operate: 'LIKE'},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
buttons:[
... ...