作者 郭盛
1 个管道 的构建 失败 耗费 6 秒

修改发短信

@@ -5,6 +5,7 @@ namespace app\admin\controller; @@ -5,6 +5,7 @@ namespace app\admin\controller;
5 use app\api\controller\Pay; 5 use app\api\controller\Pay;
6 use app\common\controller\Backend; 6 use app\common\controller\Backend;
7 use think\Db; 7 use think\Db;
  8 +use app\nsms\nsms;
8 9
9 /** 10 /**
10 * 苹果用户购买素材订单 11 * 苹果用户购买素材订单
@@ -141,8 +142,7 @@ class Iphone extends Backend @@ -141,8 +142,7 @@ class Iphone extends Backend
141 $content = "【仁甲看见SHOP】,感谢您购买仁甲看见SHOP素材。图片标题:$pic[title],云盘地址:$pic[url]"; 142 $content = "【仁甲看见SHOP】,感谢您购买仁甲看见SHOP素材。图片标题:$pic[title],云盘地址:$pic[url]";
142 //发送短信 143 //发送短信
143 144
144 - $send = new Pay();  
145 - $send->sms($mobile,$content); 145 + $this->sms($mobile,$content);
146 146
147 }elseif (empty($data['pic_id'])){ 147 }elseif (empty($data['pic_id'])){
148 $video_id = unserialize($data['video_id']); 148 $video_id = unserialize($data['video_id']);
@@ -157,8 +157,7 @@ class Iphone extends Backend @@ -157,8 +157,7 @@ class Iphone extends Backend
157 $content = "【仁甲看见SHOP】,感谢您购买仁甲看见SHOP素材。视频标题:$video[title],云盘地址:$video[eight_url]"; 157 $content = "【仁甲看见SHOP】,感谢您购买仁甲看见SHOP素材。视频标题:$video[title],云盘地址:$video[eight_url]";
158 } 158 }
159 //发送短信 159 //发送短信
160 - $send = new Pay();  
161 - $send->sms($mobile,$content); 160 + $this->sms($mobile,$content);
162 } 161 }
163 $update = $user_info['money'] - $data['total']; 162 $update = $user_info['money'] - $data['total'];
164 Db::name('user')->where('id',$user_info['id'])->update(['money'=>$update]); 163 Db::name('user')->where('id',$user_info['id'])->update(['money'=>$update]);
@@ -190,4 +189,30 @@ class Iphone extends Backend @@ -190,4 +189,30 @@ class Iphone extends Backend
190 $this->view->assign("row", $row); 189 $this->view->assign("row", $row);
191 return $this->view->fetch(); 190 return $this->view->fetch();
192 } 191 }
  192 +
  193 +
  194 +
  195 + //发送短信
  196 + public function sms($mobile,$content){
  197 + $note = array(
  198 + 'content' => $content,//短信内容
  199 + 'mobile' => $mobile,//手机号码
  200 + 'productid' => '676767',//模板id
  201 + 'xh' => ''//小号
  202 + );
  203 + $result = $this->send_sms($note);
  204 + return $result;
  205 + }
  206 + function send_sms($data){
  207 + //todo 短信账号密码
  208 +// require_once EXTEND_PATH . 'nsms/nsms.php';
  209 + $url = "http://www.ztsms.cn/sendNSms.do";
  210 + $username = 'hangpai';
  211 + $password = 'Cxz307312';
  212 + $sendAPI = new nsms($url, $username, $password);
  213 + $sendAPI->data = $data;/*初始化数据包*/
  214 + $return = $sendAPI->sendSMS('POST');
  215 + return $return;
  216 + }
  217 +
193 } 218 }
@@ -7962,7 +7962,7 @@ @@ -7962,7 +7962,7 @@
7962 7962
7963 <div class="row mt0 footer"> 7963 <div class="row mt0 footer">
7964 <div class="col-md-6" align="left"> 7964 <div class="col-md-6" align="left">
7965 - Generated on 2020-08-12 14:29:05 </div> 7965 + Generated on 2020-08-12 17:28:57 </div>
7966 <div class="col-md-6" align="right"> 7966 <div class="col-md-6" align="right">
7967 <a href="https://www.fastadmin.net" target="_blank">FastAdmin</a> 7967 <a href="https://www.fastadmin.net" target="_blank">FastAdmin</a>
7968 </div> 7968 </div>