...
|
...
|
@@ -191,6 +191,7 @@ class Pay extends Api |
|
|
$uid = $this->uid;
|
|
|
$login = Db::name('user')
|
|
|
->where('id',$uid)
|
|
|
->field('id,is_vip')
|
|
|
->find();
|
|
|
// 启动事务
|
|
|
Db::startTrans();
|
...
|
...
|
@@ -198,19 +199,21 @@ class Pay extends Api |
|
|
if(!empty($pic_id)){
|
|
|
//将购买次数加1
|
|
|
foreach ($pic_id as $key => $v){
|
|
|
//拼接发送短信的内容
|
|
|
$pic = Db::name('pic')->field('id,title,url,code')->where('id',$v)->find();
|
|
|
$str .= "图片标题:$pic[title],云盘地址:$pic[url],提取码:$pic[code],";
|
|
|
//非会员
|
|
|
if($login['is_vip'] == 0){
|
|
|
$money = $pic['money'] + $pic['price'];
|
|
|
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$money]);
|
|
|
$pic = Db::name('pic')->field('id,price,buy_num,money')->where('id',$v)->find();
|
|
|
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$pic['money']+$pic['price']]);
|
|
|
}else{
|
|
|
//是会员
|
|
|
$money = $pic['money'] + $pic['price'] * 0.75;
|
|
|
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$money]);
|
|
|
$pic = Db::name('pic')->field('id,price,buy_num,money')->where('id',$v)->find();
|
|
|
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$pic['money']+$pic['price']]);
|
|
|
}
|
|
|
}
|
|
|
//拼接发送短信的内容
|
|
|
foreach ($pic_id as $key => $v){
|
|
|
$pic = Db::name('pic')->field('id,title,url,code')->where('id',$v)->find();
|
|
|
$str .= "图片标题:$pic[title],云盘地址:$pic[url],提取码:$pic[code],";
|
|
|
}
|
|
|
}
|
|
|
if(!empty($video_id)){
|
|
|
//将购买次数加1
|
...
|
...
|
@@ -346,25 +349,32 @@ class Pay extends Api |
|
|
$this->error(['code'=>2,'msg'=>'余额不足,请充值后重试']);
|
|
|
}
|
|
|
$money = $res['money'] - $data['total'];
|
|
|
$uid = $this->uid;
|
|
|
$login = Db::name('user')
|
|
|
->where('id',$uid)
|
|
|
->field('id,is_vip')
|
|
|
->find();
|
|
|
// 启动事务
|
|
|
Db::startTrans();
|
|
|
try{
|
|
|
if(!empty($pic_id)){
|
|
|
//修改购买次数
|
|
|
foreach ($pic_id as $key => $v){
|
|
|
//拼接发送短信的内容
|
|
|
$pic = Db::name('pic')->field('id,title,url,code')->where('id',$v)->find();
|
|
|
$str .= "图片标题:$pic[title],云盘地址:$pic[url],提取码:$pic[code],";
|
|
|
//非会员
|
|
|
if($user['is_vip'] == 0){
|
|
|
$money = $pic['money'] + $pic['price'];
|
|
|
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$money]);
|
|
|
if($login['is_vip'] == 0){
|
|
|
$pic = Db::name('pic')->field('id,price,buy_num,money')->where('id',$v)->find();
|
|
|
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$pic['money']+$pic['price']]);
|
|
|
}else{
|
|
|
//是会员
|
|
|
$money = $pic['money'] + $pic['price'] * 0.75;
|
|
|
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$money]);
|
|
|
$pic = Db::name('pic')->field('id,price,buy_num,money')->where('id',$v)->find();
|
|
|
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$pic['money']+$pic['price']]);
|
|
|
}
|
|
|
}
|
|
|
//拼接发送短信内容
|
|
|
foreach ($pic_id as $key => $v){
|
|
|
$pic = Db::name('pic')->field('id,title,url,code')->where('id',$v)->find();
|
|
|
$str .= "图片标题:$pic[title],云盘地址:$pic[url],提取码:$pic[code],";
|
|
|
}
|
|
|
}
|
|
|
if(!empty($video_id)){
|
|
|
//修改购买次数
|
...
|
...
|
@@ -647,19 +657,19 @@ class Pay extends Api |
|
|
//判断用户是否为会员
|
|
|
if(!empty($pic_id)){
|
|
|
foreach ($pic_id as $key => $v){
|
|
|
//短信内容
|
|
|
$pic = Db::name('pic')->field('id,title,url,code,price,buy_num,money')->where('id',$v)->find();
|
|
|
$str .= "图片标题:$pic[title],云盘地址:$pic[url],提取码:$pic[code],";
|
|
|
//非会员
|
|
|
if($user['is_vip'] == 0){
|
|
|
$money = $pic['money'] + $pic['price'];
|
|
|
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$money]);
|
|
|
$pic = Db::name('pic')->field('id,price,buy_num,money')->where('id',$v)->find();
|
|
|
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$pic['money']+$pic['price']]);
|
|
|
}else{
|
|
|
//是会员
|
|
|
$money = $pic['money'] + $pic['price'] * 0.75;
|
|
|
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$money]);
|
|
|
$pic = Db::name('pic')->field('id,price,buy_num,money')->where('id',$v)->find();
|
|
|
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$pic['money']+$pic['price']]);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
foreach ($pic_id as $key => $v){
|
|
|
$pic = Db::name('pic')->field('id,title,url,code')->where('id',$v)->find();
|
|
|
$str .= "图片标题:$pic[title],云盘地址:$pic[url],提取码:$pic[code],";
|
|
|
}
|
|
|
}
|
|
|
if(!empty($video_id)){
|
...
|
...
|
@@ -720,21 +730,29 @@ class Pay extends Api |
|
|
$user = Db::name('user')->where('id',$data['user_id'])->find();
|
|
|
$mobile = $user['mobile'];
|
|
|
$str = "【仁甲看见】";
|
|
|
|
|
|
//判断用户是否为会员
|
|
|
$login = Db::name('user')
|
|
|
->where('id',$data['user_id'])
|
|
|
->field('id,is_vip')
|
|
|
->find();
|
|
|
|
|
|
if(!empty($pic_id)){
|
|
|
foreach ($pic_id as $key => $v){
|
|
|
//短信内容
|
|
|
$pic = Db::name('pic')->field('id,title,url,code')->where('id',$v)->find();
|
|
|
$str .= "图片标题:$pic[title],云盘地址:$pic[url],提取码:$pic[code],";
|
|
|
//非会员
|
|
|
if($user['is_vip'] == 0){
|
|
|
$money = $pic['money'] + $pic['price'];
|
|
|
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$money]);
|
|
|
if($login['is_vip'] == 0){
|
|
|
$pic = Db::name('pic')->field('id,price,buy_num,money')->where('id',$v)->find();
|
|
|
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$pic['money']+$pic['price']]);
|
|
|
}else{
|
|
|
//是会员
|
|
|
$money = $pic['money'] + $pic['price'] * 0.75;
|
|
|
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$money]);
|
|
|
$pic = Db::name('pic')->field('id,price,buy_num,money')->where('id',$v)->find();
|
|
|
Db::name('pic')->where('id',$pic['id'])->update(['buy_num'=>$pic['buy_num']+1,'money'=>$pic['money']+$pic['price']]);
|
|
|
}
|
|
|
}
|
|
|
foreach ($pic_id as $key => $v){
|
|
|
$pic = Db::name('pic')->field('id,title,url,code')->where('id',$v)->find();
|
|
|
$str .= "图片标题:$pic[title],云盘地址:$pic[url],提取码:$pic[code],";
|
|
|
}
|
|
|
}
|
|
|
if(!empty($video_id)){
|
|
|
foreach ($video_id as $key => $val){
|
...
|
...
|
|