...
|
...
|
@@ -1807,52 +1807,7 @@ class User extends Api |
|
|
//查询用户余额是否充足
|
|
|
if($user['money'] < $param['total']){
|
|
|
$data['is_enough'] = 2;
|
|
|
|
|
|
$where['user_id'] = ['eq',$param['user_id']];
|
|
|
$where['status'] = ['eq',2];
|
|
|
if(!empty($video['id']) && !empty($video['attr'])){
|
|
|
$video_s = serialize($video);
|
|
|
//查看该图片或者该视频属性是否已经购买过
|
|
|
$res = Db::name('iphone')
|
|
|
->where($where)
|
|
|
->where('video_id',$video_s)
|
|
|
->find();
|
|
|
if(!empty($res)){
|
|
|
$this->error(['code'=>2,'msg'=>'该属性的视频已经购买过了']);
|
|
|
}
|
|
|
$param['video_id'] = serialize($video);
|
|
|
}else{
|
|
|
//查询图片ID
|
|
|
$arr = Db::name('iphone')
|
|
|
->field('pic_id')
|
|
|
->where($where)
|
|
|
->select();
|
|
|
foreach ($arr as &$v){
|
|
|
if(!empty($v['pic_id'])){
|
|
|
if($v['pic_id'] == $pic_id){
|
|
|
$this->error(['code'=>2,'msg'=>'该图片已经购买过了','pic_id'=>$pic_id]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
$param['pic_id'] = $pic_id;
|
|
|
}
|
|
|
$param['createtime'] = time();
|
|
|
$param['num'] = date('Ymd').substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8);
|
|
|
$data = Db::name('iphone')
|
|
|
->insertGetId($param);
|
|
|
if(empty($data)){
|
|
|
$this->error(['code'=>2,'msg'=>'sql执行失败']);
|
|
|
}else{
|
|
|
//发送短信,通知客户
|
|
|
$mobile = 13780608990;
|
|
|
$mobile1 = 15588311507;
|
|
|
$content = "【仁甲看见SHOP】提醒您,您有新苹果客户下了订单,客户电话为:$user[mobile] ,请您及时回复!";
|
|
|
//发送短信
|
|
|
$send = new Pay();
|
|
|
$send->sms($mobile,$content);
|
|
|
$send->sms($mobile1,$content);
|
|
|
$this->success('SUCCESS',$data);
|
|
|
}
|
|
|
$this->success('success',$data);
|
|
|
|
|
|
}else{
|
|
|
$data['is_enough'] = 1;
|
...
|
...
|
|