Ejemplo n.º 1
0
 function action_get_code($mobile)
 {
     $is_register = self::_db()->select_row('select id from et_user where mobile = ? ', $mobile);
     if ($is_register) {
         throw new Exception("当前号码已经注册过");
     }
     PtApp::session_start();
     //注册验证码
     $reg_captcha = $_SESSION['reg_captcha_' . $mobile] = rand(1000, 9999) . rand(10, 99);
     $project = "6pvkv3";
     $option = array('code' => $reg_captcha);
     Model_Tools_Sms::sendsms($mobile, $project, $option);
     return "手机验证码已发送";
 }
Ejemplo n.º 2
0
 function action_get_code($mobile)
 {
     //查询手机号是不是存在
     $is_register = self::_db()->select_row('select id from et_user where mobile = ? ', $mobile);
     //如果手机号不存在;
     if (!$is_register) {
         throw new Exception("当前号码没有注册过");
     }
     //开启session
     PtApp::session_start();
     //生成session验证码,并且关联手机号
     $forgetpass_captcha = $_SESSION['forgetpass_captcha_' . $mobile] = rand(1000, 9999) . rand(10, 99);
     $project = "6pvkv3";
     $option = array('code' => $forgetpass_captcha);
     Model_Tools_Sms::sendsms($mobile, $project, $option);
     return "手机验证码已发送";
 }
Ejemplo n.º 3
0
 function action_audit($id, $status)
 {
     try {
         $userDatas = self::_db()->select_row('select c.id,c.uid,c.real_name,i.invite_id ,u.mobile
               from et_user_campus as c
               left join et_user_invite as i on i.uid = c.uid
               left join et_user as u on u.id = c.uid
               where c.id =  ? ', $id);
         self::_db()->update('et_user_campus', array('status' => $status, "up_time" => date_time_now()), array('id' => $id));
         $mobile = $userDatas['mobile'];
         $name = $userDatas['real_name'];
         //$mobile = '18601628937';
         if ($status == 1) {
             //通过
             self::_db()->bt();
             $add_money = $GLOBALS['setting']['campus']['add_money'];
             self::_db()->run_sql("update et_user_finance set balance_ntx = balance_ntx + " . $add_money . " where uid = ?", $userDatas['uid']);
             self::_db()->insert("et_user_finance_log", array("uid" => $userDatas['uid'], "amount" => $add_money, "type" => 11, "note" => "校园达人参与活动奖励", "add_time" => date_time_now()));
             $invite_user = self::_db()->select_row('select invite_id from et_user_invite  where uid =  ? ', $userDatas['uid']);
             if (!empty($invite_user['invite_id'])) {
                 $_invite_campus = self::_db()->select_row('select c.status from et_user_campus as c where c.uid =  ? ', $invite_user['invite_id']);
                 if ($_invite_campus && $_invite_campus['status'] == 1) {
                     $invite_money = $GLOBALS['setting']['campus']['invite_money'];
                     self::_db()->run_sql("update et_user_finance set balance_ntx = balance_ntx + " . $invite_money . " where uid = ?", $invite_user['invite_id']);
                     self::_db()->insert("et_user_finance_log", array("uid" => $invite_user['invite_id'], "amount" => $invite_money, "type" => 12, "note" => "校园达人邀请奖励", "add_time" => date_time_now()));
                 }
             }
             self::_db()->commit();
             if ($mobile) {
                 $res = Model_Tools_Sms::sendsms($mobile, "oV3NQ3", array("name" => $name));
                 //print_r($res);exit;
             }
         } else {
             //拒绝
             if ($mobile) {
                 $res = Model_Tools_Sms::sendsms($mobile, "flACZ1", array("name" => $name));
                 self::_db()->delete("et_user_campus", array("id" => $userDatas['id']));
                 //print_r($res);exit;
             }
         }
         return array("ok");
     } catch (Exception $e) {
         self::_db()->rollback();
         throw new Exception($e->getMessage());
     }
 }