| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace backend\models;
- class SmsApi extends BaseApi
- {
- public $apiUrl = 'sms';
- /**
- * @param string $mobile
- * @return array
- */
- public function sendCode($mobile)
- {
- $result = $this->get($this->apiUrl . '/send-code', ['mobile' => $mobile]);
- if ($result['code'] == 1) {
- return $this->returnArray(1, $result['data'], '验证码发送成功');
- } else {
- return $this->returnArray(0, [], '验证码发送失败');
- }
- }
- /**
- * @param string $mobile
- * @return array
- */
- public function getCode($mobile)
- {
- $result = $this->get($this->apiUrl . '/get-code', ['mobile' => $mobile]);
- if ($result['code'] == 1) {
- return $this->returnArray(1, $result['data'], '获取验证码成功');
- } else {
- return $this->returnArray(0, [], '获取验证码失败');
- }
- }
- }
|