|
@@ -70,15 +70,10 @@ class Base
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
- public function sendCode($skin, $mobile, $code = false)
|
|
|
+ public function sendCode($skin, $mobile)
|
|
|
{
|
|
|
$this->config($skin)->mobile($mobile);
|
|
|
|
|
|
- if ($code) {
|
|
|
- $save = Dever::session($this->config['key']);
|
|
|
- return $mobile . '_' . $code == $save;
|
|
|
- }
|
|
|
-
|
|
|
$day = date('Ymd', time());
|
|
|
|
|
|
|
|
@@ -113,13 +108,28 @@ class Base
|
|
|
$insert['mobile'] = $mobile;
|
|
|
$insert['day'] = $day;
|
|
|
$insert['code'] = $code;
|
|
|
+ $insert['status'] = 1;
|
|
|
$insert['result'] = Dever::json_encode($result);
|
|
|
$id = Dever::db('sms/code')->insert($insert);
|
|
|
|
|
|
- Dever::session($this->config['key'], $mobile . '_' . $code, $this->config['code_timeout']);
|
|
|
+
|
|
|
|
|
|
return $code;
|
|
|
}
|
|
|
+
|
|
|
+ public function checkCode($skin, $mobile, $code)
|
|
|
+ {
|
|
|
+ if ($code) {
|
|
|
+
|
|
|
+
|
|
|
+ $save = Dever::db('sms/code')->one(array('mobile' => $mobile, 'status' => 1));
|
|
|
+ if ($code == $save) {
|
|
|
+ Dever::db('sms/code')->update(array('where_id' => $save['id'], 'status' => 2));
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
private function replace($content, $param)
|