作者 Cool
1 个管道 的构建 通过 耗费 0 秒

余额不足调试

@@ -1807,10 +1807,45 @@ class User extends Api @@ -1807,10 +1807,45 @@ class User extends Api
1807 //查询用户余额是否充足 1807 //查询用户余额是否充足
1808 if($user['money'] < $param['total']){ 1808 if($user['money'] < $param['total']){
1809 $data['is_enough'] = 2; 1809 $data['is_enough'] = 2;
  1810 + $where['user_id'] = ['eq',$param['user_id']];
  1811 + $where['status'] = ['eq',2];
  1812 + if(!empty($video['id']) && !empty($video['attr'])){
  1813 + $video_s = serialize($video);
  1814 + //查看该图片或者该视频属性是否已经购买过
  1815 + $res = Db::name('iphone')
  1816 + ->where($where)
  1817 + ->where('video_id',$video_s)
  1818 + ->find();
  1819 + if(!empty($res)){
  1820 + $this->error('该属性视频您已经买过了',['code'=>2]);
  1821 + }
  1822 + $param['video_id'] = serialize($video);
  1823 + }else{
  1824 + //查询图片ID
  1825 + $arr = Db::name('iphone')
  1826 + ->field('pic_id')
  1827 + ->where($where)
  1828 + ->select();
  1829 + foreach ($arr as &$v){
  1830 + if(!empty($v['pic_id'])){
  1831 + if($v['pic_id'] == $pic_id){
  1832 + $this->error('您已经买过了',['code'=>2]);
  1833 + }
  1834 + }
  1835 + }
  1836 + $param['pic_id'] = $pic_id;
  1837 + }
  1838 + $param['createtime'] = time();
  1839 + $param['num'] = date('Ymd').substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8);
  1840 + $data_order = Db::name('iphone')
  1841 + ->insertGetId($param);
  1842 + if(empty($data_order)){
  1843 + $this->error('sql执行失败');
  1844 + }
1810 1845
1811 //发送短信,通知客户 1846 //发送短信,通知客户
1812 - $mobile = 15620699961; // 13780608990  
1813 - $mobile1 = 13920339175; // 15588311507 1847 + $mobile = 13780608990;
  1848 + $mobile1 = 15588311507;
1814 $content = "【仁甲看见SHOP】提醒您,您有新的苹果客户,客户电话为:$user[mobile] ,请您及时回复!"; 1849 $content = "【仁甲看见SHOP】提醒您,您有新的苹果客户,客户电话为:$user[mobile] ,请您及时回复!";
1815 //发送短信 1850 //发送短信
1816 $send = new Pay(); 1851 $send = new Pay();