bug修复
This commit is contained in:
@@ -122,7 +122,7 @@ class Ad extends Admin {
|
|||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
$result = $ad->change();
|
$result = $ad->change();
|
||||||
if ($result) {
|
if ($result) {
|
||||||
return $this->success("添加成功!", url('admin/ad/lists', array('id' => $this->param['place_id'])));
|
return $this->success("添加成功!", url('admin/ad/lists', array('id' => $this->request->param('place_id')))));
|
||||||
} else {
|
} else {
|
||||||
return $this->error($ad->getError());
|
return $this->error($ad->getError());
|
||||||
}
|
}
|
||||||
@@ -143,7 +143,7 @@ class Ad extends Admin {
|
|||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
$result = $ad->change();
|
$result = $ad->change();
|
||||||
if ($result) {
|
if ($result) {
|
||||||
return $this->success("修改成功!", url('admin/ad/lists', array('id' => $this->param['place_id'])));
|
return $this->success("修改成功!", url('admin/ad/lists', array('id' => $this->param('place_id'))));
|
||||||
} else {
|
} else {
|
||||||
return $this->error($ad->getError());
|
return $this->error($ad->getError());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class Attribute extends Admin {
|
|||||||
*/
|
*/
|
||||||
public function add($model_id = '') {
|
public function add($model_id = '') {
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
$result = $this->model->validate('attribute.add')->save($this->param);
|
$result = $this->model->validate('attribute.add')->save($this->request->param());
|
||||||
if (false !== $result) {
|
if (false !== $result) {
|
||||||
return $this->success("创建成功!", url('Attribute/index', array('model_id' => $model_id)));
|
return $this->success("创建成功!", url('Attribute/index', array('model_id' => $model_id)));
|
||||||
} else {
|
} else {
|
||||||
@@ -92,7 +92,7 @@ class Attribute extends Admin {
|
|||||||
*/
|
*/
|
||||||
public function edit($id = '', $model_id = '') {
|
public function edit($id = '', $model_id = '') {
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
$result = $this->model->validate('attribute.edit')->save($this->param, array('id'=>$id));
|
$result = $this->model->validate('attribute.edit')->save($this->request->param(), array('id'=>$id));
|
||||||
if ($result) {
|
if ($result) {
|
||||||
return $this->success("修改成功!", url('Attribute/index', array('model_id' => $model_id)));
|
return $this->success("修改成功!", url('Attribute/index', array('model_id' => $model_id)));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ class Content extends Admin {
|
|||||||
*/
|
*/
|
||||||
public function edit($id) {
|
public function edit($id) {
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
$result = $this->model->save($this->param, array('id'=> $id));
|
$result = $this->model->save($this->request->param(), array('id'=> $id));
|
||||||
if ($result !== false) {
|
if ($result !== false) {
|
||||||
//记录行为
|
//记录行为
|
||||||
action_log('update_content', 'content', $result, session('auth_user.uid'));
|
action_log('update_content', 'content', $result, session('auth_user.uid'));
|
||||||
@@ -139,7 +139,8 @@ class Content extends Admin {
|
|||||||
* @author molong <ycgpp@126.com>
|
* @author molong <ycgpp@126.com>
|
||||||
*/
|
*/
|
||||||
public function del() {
|
public function del() {
|
||||||
$id = $this->getArrayParam('id');
|
$param = $this->request->param();
|
||||||
|
$id = $param['id'];
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
return $this->error("非法操作!");
|
return $this->error("非法操作!");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,8 +195,10 @@ class Form extends Admin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function editattr(\think\Request $request){
|
public function editattr(\think\Request $request){
|
||||||
$form_id = isset($this->param['form_id']) ? $this->param['form_id'] : '';
|
$param = $this->request->param();
|
||||||
$id = isset($this->param['id']) ? $this->param['id'] : '';
|
|
||||||
|
$form_id = isset($param['form_id']) ? $param['form_id'] : '';
|
||||||
|
$id = isset($param['id']) ? $param['id'] : '';
|
||||||
if (!$form_id || !$id) {
|
if (!$form_id || !$id) {
|
||||||
return $this->error('非法操作!');
|
return $this->error('非法操作!');
|
||||||
}
|
}
|
||||||
@@ -221,7 +223,7 @@ class Form extends Admin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function delattr(\think\Request $request){
|
public function delattr(\think\Request $request){
|
||||||
$id = isset($this->param['id']) ? $this->param['id'] : 0;
|
$id = isset($request->param('id')) ? $request->param('id') : 0;
|
||||||
if (!$id) {
|
if (!$id) {
|
||||||
return $this->error('非法操作!');
|
return $this->error('非法操作!');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
{volist name="list" id="item"}
|
{volist name="list" id="item"}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
{if $item['avatar_url']}
|
{if isset($item['avatar_url']) && $item['avatar_url']}
|
||||||
<img src="{$item['avatar_url']}" alt="{$item['nickname']}"/>
|
<img src="{$item['avatar_url']}" alt="{$item['nickname']}"/>
|
||||||
{else/}
|
{else/}
|
||||||
<img src="{:avatar($item['uid'])}" alt="{$item['nickname']}"/>
|
<img src="{:avatar($item['uid'])}" alt="{$item['nickname']}"/>
|
||||||
|
|||||||
@@ -1,12 +1,26 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace app\api\controller;
|
namespace app\api\controller;
|
||||||
|
|
||||||
class Index extends \app\common\controller\Api {
|
class Index extends \app\common\controller\Api{
|
||||||
|
|
||||||
public $mustToken = true;
|
public $mustToken = false;
|
||||||
|
|
||||||
public function usercount(){
|
public function usercount(){
|
||||||
$this->data['data'] = array('team_num'=>100,'coustomer_num'=>10000);
|
$this->data['data'] = array('team_num'=>100,'coustomer_num'=>10000);
|
||||||
return $this->data;
|
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]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->data['data'] = $data;
|
||||||
|
return $this->data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
39
application/api/controller/Login.php
Normal file
39
application/api/controller/Login.php
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
class Login extends \app\common\controller\Api{
|
||||||
|
|
||||||
|
|
||||||
|
public function index(){
|
||||||
|
$username = $this->request->param('username', '');
|
||||||
|
$password = $this->request->param('password', '');
|
||||||
|
|
||||||
|
if (!$username || !$password) {
|
||||||
|
$this->data['code'] = 1;
|
||||||
|
$this->data['msg'] = "账号密码不能为空!";
|
||||||
|
return $this->data;
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = db('Member')->where('username', $username)->find();
|
||||||
|
if ($user && $user['status'] == 1) {
|
||||||
|
if ($user['password'] == md5($password . $user['salt'])) {
|
||||||
|
|
||||||
|
$info['access_token'] = authcode($user['uid'].'|'.$user['username'].'|'.$user['password'], 'ENCODE');
|
||||||
|
$info['uid'] = $user['uid'];
|
||||||
|
$info['username'] = $user['username'];
|
||||||
|
$info['avatar'] = (isset($user['avatar_url']) && $user['avatar_url']) ? $user['avatar_url'] : avatar($user['uid']);
|
||||||
|
|
||||||
|
$this->data['data'] = $info;
|
||||||
|
return $this->data;
|
||||||
|
}else{
|
||||||
|
$this->data['code'] = 1;
|
||||||
|
$this->data['msg'] = "密码错误!";
|
||||||
|
return $this->data;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$this->data['code'] = 1;
|
||||||
|
$this->data['msg'] = "无此账户或账户被禁用!";
|
||||||
|
return $this->data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,19 +30,24 @@ class Wechat extends \app\common\controller\Api{
|
|||||||
|
|
||||||
$info = $app->auth->session($param['jsCode']);
|
$info = $app->auth->session($param['jsCode']);
|
||||||
|
|
||||||
//查询用户是否已添加
|
if (isset($info['openid']) && $info['openid']) {
|
||||||
$user = db('Member')->where('openid', $info['openid'])->find();
|
//查询用户是否已添加
|
||||||
if (!$user) {
|
$user = db('Member')->where('openid', $info['openid'])->find();
|
||||||
$other = array(
|
if (!$user) {
|
||||||
'avatar_url' => $param['avatar'],
|
$other = array(
|
||||||
);
|
'avatar_url' => $param['avatar'],
|
||||||
$user = model('Member')->register($param['nickname'], $param['openid'], $param['openid'], $param['openid'].'@wx.com', false, $other);
|
);
|
||||||
|
$user = model('Member')->register($param['nickname'], $param['openid'], $param['openid'], $param['openid'].'@wx.com', false, $other);
|
||||||
|
}
|
||||||
|
|
||||||
|
$info['access_token'] = authcode($user['uid'].'|'.$user['username'].'|'.$user['password'], 'ENCODE');
|
||||||
|
$info['uid'] = $user['uid'];
|
||||||
|
|
||||||
|
$this->data['data'] = $info;
|
||||||
|
}else{
|
||||||
|
$this->data['code'] = 1;
|
||||||
|
$this->data['msg'] = '非法操作!';
|
||||||
}
|
}
|
||||||
|
|
||||||
$info['access_token'] = authcode($user['uid'].'|'.$user['username'].'|'.$user['password'], 'ENCODE');
|
|
||||||
$info['uid'] = $user['uid'];
|
|
||||||
|
|
||||||
$this->data['data'] = $info;
|
|
||||||
|
|
||||||
return json($this->data);
|
return json($this->data);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user