Commit 9ea97b03 authored by hujun's avatar hujun

修改登录返回信息

parent 7fbad51a
......@@ -29,6 +29,8 @@ class Broker extends Basic
* 经纪人登录
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function login() {
......@@ -37,19 +39,19 @@ class Broker extends Basic
$data['status'] = 101;
if ($this->params['phone'] && $this->params['pwd']) {
$agents_data = $this->a_agents->get([
'phone' => $this->params['phone'],
'status' => 0
]);
$agents_data = $this->a_agents->getInfo($this->params['phone'], $this->params['pwd']);
if (isset($agents_data->id) && ($agents_data->status == 0)) {
if ($agents_data->password == md5($this->params['pwd'])) {
$agents_data->last_login_ip = ip2long($this->request->ip());
$agents_data->last_login_time = date('Y-m-d H:i:s');
$agents_data->save();
$agents_data->allowField(true)->save();
if ($agents_data->img) {
$agents_data->img = HEADERIMGURL.$agents_data->img;
$agents_data->img = AGENTHEADERIMGURL.$agents_data->img;
}
$jwt_data['id'] = $agents_data->id;
$jwt_data['name'] = $agents_data->name;
$jwt_data['phone'] = $agents_data->phone;
......
<?php
/**
* Created by PhpStorm.
* User: fuju
* User: fu ju
* Date: 2018/1/20
* Time: 17:52
*/
......@@ -11,12 +11,45 @@ use think\Db;
class AAgents extends BaseModel
{
/**
* 返回经纪人和部门信息
*
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getInfo($phone) {
$agents_data = $this->where([
'phone' => $phone,
'status' => 0
])->find();
if (!empty($agents_data->store_id)) {
$store_name = Db::table('a_store')->where('id',$agents_data['store_id'])->value('store_name');
$agents_data['department'] = $store_name;
}
public function saveList(){
if (!empty($agents_data->auth_group_id)) {
$district_name = Db::table('a_district')->where('id',$agents_data['district_id'])->value('district_name');
$agents_data['department'] = $agents_data['department'] ? $district_name.'-'.$store_name : $district_name;
}
}
$agents_data['commission'] = 500;
switch ($agents_data['level']) {
case 10 :
$agents_data['level_name'] = '业务员';break;
case 20 :
$agents_data['level_name'] = '店长';break;
case 30 :
$agents_data['level_name'] = '总监';break;
case 40 :
$agents_data['level_name'] = '总监';break;
}
return $agents_data;
}
/**分页列表
* @param int $p
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment