接口文档更新

This commit is contained in:
2018-08-12 17:42:34 +08:00
parent 7433530805
commit 1f251a9103
7 changed files with 289 additions and 40 deletions

View File

@@ -1,26 +1,67 @@
<?php
namespace app\api\controller;
use Overtrue\EasySms\EasySms;
class Index extends \app\common\controller\Api{
public $mustToken = false;
public function usercount(){
$this->data['data'] = array('team_num'=>100,'coustomer_num'=>10000);
public function getconfig(){
$map = array(
'status' => 1,
'group' => array('NOTIN', array('0', '1', '2', '3','99'))
);
$this->data['config'] = model('Config')->lists($map);
return $this->data;
}
public function getlive(){
$fp = fopen(ROOT_PATH . DS . 'live.txt', 'r');
$info = fread($fp, filesize(ROOT_PATH . DS . 'live.txt'));
fclose($fp);
$res = explode("\n", $info);
foreach ($res as $value) {
$val = explode(",", $value);
$data[] = array('name'=>$val[0],'src'=>$val[1]);
public function region(){
$pname = $this->request->param('pname');
$map['is_show'] = 1;
if ($pname) {
$upid = db('District')->where(array('name'=>array('LIKE', "%".$pname."%")))->value('id');
$map['upid'] = $upid;
$data = db('District')->where($map)->column('name');
$this->data['data'] = $data;
}else{
$map['upid'] = $this->request->param('pid', 0);
$data = db('District')->where($map)->column('name');
$this->data['data'] = $data;
}
return $this->data;
}
$this->data['data'] = $data;
public function getcode($mobile = ''){
if ($mobile == '') {
$this->data['code'] = 1;
$this->data['msg'] = "电话号码不能为空!";
}else{
$time = db('MobileCode')->where('mobile', $mobile)->value('time');
if ($time && (time() - $time) < 60) {
$this->data['code'] = 1;
return $this->data;
}
$config = config('msg');
$easySms = new EasySms($config);
$data = array(
'mobile' => $mobile,
'code' => rand(100000, 999999),
'time' => time()
);
try {
$result = $easySms->send($data['mobile'], [
'content' => '您本次的验证码为:' . $data['code'] . '请在1分钟内输入。',
'template' => '94745'
]
);
} catch (Exception $e) {
dump($e);
}
if ($result['qcloud']['status'] == 'success') {
db('MobileCode')->insert($data);
}
}
return $this->data;
}
}