コード例 #1
0
ファイル: UserController.class.php プロジェクト: Orchild/mt
 /**
  * 获取验证码
  * @param string username 手机号码
  * @param int forget 忘记密码的手机号码
  */
 public function verifily_post()
 {
     $telphone = PUT('username');
     $forget = PUT('forget');
     $type = PUT('type');
     if ($forget) {
         if (empty($forget)) {
             $this->error('手机号码不能为空');
         }
         if (!$this->model->checkMobile($forget)) {
             $this->error('该手机号码没有注册');
         }
         $telphone = $forget;
     } else {
         if (empty($telphone)) {
             $this->error('手机号码不能为空');
         }
         if ($this->model->checkMobile($telphone)) {
             $this->error('该手机号码已经注册');
         }
     }
     $verifily = create_password();
     // session('verifily',$verifily);
     // $this->success('验证码发送成功',$verifily);
     // exit;
     //$result         = curl(C('SMS.sms_url'),C('SMS.sms_key'),array('mobile'=>$telphone,'message'=>'验证码:'.$verifily.C('SMS.sms_company')));
     $msg = '验证码:' . $verifily . C('SMS.sms_company');
     $result = Luosimao::send($type, $telphone, $verifily);
     if ($result['error'] == 0) {
         $this->success('验证码发送成功', $verifily);
     } else {
         $this->error($result['msg']);
     }
     //         $res            = json_decode($result,true);
     //         if($res['error']==0){
     //             session('verifily',$verifily);
     //     	   $this->success('验证码发送成功',$verifily);
     //         }else{
     //             $this->error('验证码发送失败');
     //         }
 }
コード例 #2
0
 /**
  * 短信通知
  */
 public function smsNotify()
 {
     if (IS_POST) {
         $user_id = PUT('user_id');
         $msg_id = PUT('msg_id');
         $map = array();
         $map['id'] = $user_id;
         $user = D('User')->where($map)->find();
         $where['id'] = $msg_id;
         $message = D('Message')->where($where)->find();
         $title = $message['title'];
         //wlog('$title', $title);
         $telephone = $user['username'];
         //wlog('$username', $telephone);
         $msg = '111';
         $msg = "温馨提醒:请尽快完成《" . $title . "》消息的阅读。【洞头人才】";
         $res = Luosimao::send(3, $telephone, $msg);
         //wlog('sms', $res);
         if ($res['error'] == 0) {
             $this->success('短信通知完成');
         } else {
             $this->error($res['msg']);
         }
     }
 }