...
|
...
|
@@ -1807,10 +1807,45 @@ 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]);
|
|
|
}
|
|
|
$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]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
$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_order = Db::name('iphone')
|
|
|
->insertGetId($param);
|
|
|
if(empty($data_order)){
|
|
|
$this->error('sql执行失败');
|
|
|
}
|
|
|
|
|
|
//发送短信,通知客户
|
|
|
$mobile = 15620699961; // 13780608990
|
|
|
$mobile1 = 13920339175; // 15588311507
|
|
|
$mobile = 13780608990;
|
|
|
$mobile1 = 15588311507;
|
|
|
$content = "【仁甲看见SHOP】提醒您,您有新的苹果客户,客户电话为:$user[mobile] ,请您及时回复!";
|
|
|
//发送短信
|
|
|
$send = new Pay();
|
...
|
...
|
|