作者 郭盛
1 个管道 的构建 通过 耗费 10 秒

修改统计老师下了多少单

... ... @@ -60,10 +60,11 @@ class Pay extends Api
$update['transaction_id'] = $notify->transaction_id;
//判断用户是否有邀请人
$invite = Db::name('user')->where('id',$order['user_id'])->find();
//没有邀请人
if(empty($invite['invite_id'])){
// 用户是否支付成功
if ($successful) {
if(empty($order['coupon_id'])){
if(!empty($order['coupon_id'])){
//修改优惠劵为已使用
Db::name('coupon')->where('id',$order['coupon_id'])->update(['is_use'=>1]);
}
... ... @@ -74,6 +75,8 @@ class Pay extends Api
$update['expirationtime'] = $update['paytime'] + 86400*7;
$update['finish_status'] = 1;
Db::name('teacher')->where('id',$order['teacher_id'])->setInc('help_num');
Db::name('teacher')->where('id',$order['teacher_id'])->setInc('count');
Db::name('territory')->where('id',$order['territory_id'])->setInc('buynum');
// 创建融云用户、群组
$teacher_id = Db::name('teacher')->where('id',$order['teacher_id'])->value('user_id');
$rongyun_chat = $this->rongyun_handle($order['user_id'].','.$teacher_id,$order['id']);
... ... @@ -88,6 +91,7 @@ class Pay extends Api
Db::commit();
return true; // 返回处理完成
}else{
//有邀请人
//判断邀请的用户是否第一次购买
$is_one = Db::name('order')->where('user_id',$order['user_id'])->where('status',2)->find();
... ... @@ -111,6 +115,8 @@ class Pay extends Api
$coupon['expirationtime'] = $coupon['createtime']+7*86400;
Db::name('coupon')->insertGetId($coupon);
Db::name('teacher')->where('id',$order['teacher_id'])->setInc('help_num');
Db::name('teacher')->where('id',$order['teacher_id'])->setInc('count');
Db::name('territory')->where('id',$order['territory_id'])->setInc('buynum');
// 创建融云用户、群组
$teacher_id = Db::name('teacher')->where('id',$order['teacher_id'])->value('user_id');
$rongyun_chat = $this->rongyun_handle($order['user_id'].','.$teacher_id,$order['id']);
... ... @@ -138,6 +144,8 @@ class Pay extends Api
$update['expirationtime'] = $update['paytime'] + 86400*7;
$update['finish_status'] = 1;
Db::name('teacher')->where('id',$order['teacher_id'])->setInc('help_num');
Db::name('teacher')->where('id',$order['teacher_id'])->setInc('count');
Db::name('territory')->where('id',$order['territory_id'])->setInc('buynum');
// 创建融云用户、群组
$teacher_id = Db::name('teacher')->where('id',$order['teacher_id'])->value('user_id');
... ... @@ -179,7 +187,7 @@ class Pay extends Api
}
// 用户是否支付成功
if ($successful) {
if(empty($order['coupon_id'])){
if(!empty($order['coupon_id'])){
//修改优惠劵为已使用
Db::name('coupon')->where('id',$order['coupon_id'])->update(['is_use'=>1]);
}
... ... @@ -203,6 +211,8 @@ class Pay extends Api
->where('id',$order['order_id'])
->update(['expirationtime'=>$update['paytime'] + 86400*7,'finish_status'=>1]);
}
Db::name('teacher')->where('id',$info['teacher_id'])->setInc('count');
Db::name('territory')->where('id',$info['territory_id'])->setInc('buynum');
} else { // 用户支付失败
$update['status']=1;
}
... ...
... ... @@ -9583,7 +9583,7 @@
<div class="row mt0 footer">
<div class="col-md-6" align="left">
Generated on 2020-03-20 10:08:28 </div>
Generated on 2020-03-20 11:27:27 </div>
<div class="col-md-6" align="right">
<a href="https://www.fastadmin.net" target="_blank">FastAdmin</a>
</div>
... ...
... ... @@ -28,6 +28,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// {field: 'teacher.thumbnail', title: __('Teacher.thumbnail'), operate:false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'contype.title', title: __('擅长领域名称')},
{field: 'money', title: __('价格')},
{field: 'buynum', title: __('购买次数')},
// {field: 'content', title: __('领域优势')},
// {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
// {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
... ...
... ... @@ -58,6 +58,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'income', title: __('总收入'), operate:false},
{field: 'withdraw', title: __('提现金额'), operate:false},
{field: 'balance', title: __('账号余额'), operate:false},
{field: 'count', title: __('总订单数'), operate:false},
// {field: 'level', title: __('Level'), operate:false},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
... ...