Commit 64bb11b6 authored by clone's avatar clone

Merge branch 'test'

parents 52979bac c61697fb
......@@ -38,8 +38,8 @@ class Performance extends Basic
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"agent_id" => 10013,
"type" => 1, //1表示个人业绩排行 2门店 3区域
"agent_id" => 80,
"type" => 3, //1表示个人业绩排行 2门店 3区域
"end_day" => "",
"start_day" =>""
);*/
......@@ -47,7 +47,7 @@ class Performance extends Basic
return $this->response("101", "请求参数错误");
}
//默认排序一周
$end_day = !empty($params["end_day"]) ? $params["end_day"] : date("Y-m-d", strtotime("-1 day"));
$end_day = !empty($params["end_day"]) ? $params["end_day"] : date("Y-m-d", time());
$start_day = !empty($params["start_day"]) ? $params["start_day"] : date("Y-m-d", strtotime("-7 day"));
$list = $this->service_->totalAgent($params["agent_id"], $params["type"], $end_day, $start_day);
//dump($list);
......
......@@ -200,11 +200,11 @@ class Shop extends Basic
public function getShopDetail()
{
header('Access-Control-Allow-Origin:*');
$params = array(
/* $params = array(
"id" => 4,
"site_area" => 3, //1.c端 3.b端
//"user_id" => 2 //if c端 用户登录后传入user_id
);
);*/
$params = $this->params;
$conditions = [];
......
......@@ -134,8 +134,10 @@ class Basic extends Controller
public function verifyAgentInfo()
{
$agentModel = new AAgents();
$agentArr = $agentModel->getAgentById("id,store_id,name,phone");
if (count($agentArr) > 0 && ($agentArr["id"] != $this->agentId || $agentArr["user_phone"] != $this->agentPhone)) {
$params["status"] = 0;
$params["id"] = $this->agentId;
$agentArr = $agentModel->getAgentById("id,store_id,name,phone",$params);
if (count($agentArr) > 0 && ($agentArr["id"] != $this->agentId )) {
echo json_encode(array( "code" => "300", "msg" => "用户验证失败,重新登录!", "data" => [], "type" => "json" ));
exit;
}
......
......@@ -91,9 +91,11 @@ class PerformanceService
if ($value["store_id"] == $agent_info["store_id"] || $key < 5) {
$value["index_"] = $key + 1;
$value["is_my"] = $agent_info["store_id"];
$info = $this->agentModel->getAgentsInfoByAgentId($field, [ "agent_id" => $value["agent_id"] ]);
$info = $this->agentModel->getAgentsInfoByAgentId($field, [ "agent_id" => $value["agent_id"] ,""]);
$store_name = $this->agentModel->getStoreOrDistrict(["store_id"=>$value["store_id"],"level"=>20]);
$name = count($store_name) > 0 ? $store_name[0]["name"] : "---";
if (count($info) > 0) {
$value["name"] = $info[0]["name"];
$value["name"] = $name;
$value["img"] = AGENTHEADERIMGURL . $info[0]["img"];
$value["store_name"] = $info[0]["store_name"];
$value["district_name"] = $info[0]["district_name"];
......@@ -105,8 +107,10 @@ class PerformanceService
$value["index_"] = $key + 1;
$value["is_my"] = $agent_info["district_id"];
$info = $this->agentModel->getAgentsInfoByAgentId($field, [ "agent_id" => $value["agent_id"] ]);
$district_name = $this->agentModel->getStoreOrDistrict(["store_id"=>$value["store_id"],"level"=>["in","30,40"]]);
$name = count($district_name) > 0 ? $district_name[0]["name"] : "---";
if (count($info) > 0) {
$value["name"] = $info[0]["name"];
$value["name"] = $name;
$value["img"] = AGENTHEADERIMGURL . $info[0]["img"];
$value["store_name"] = $info[0]["store_name"];
$value["district_name"] = $info[0]["district_name"];
......
......@@ -444,6 +444,15 @@ class AAgents extends BaseModel
}
public function getStoreOrDistrict($params){
$result = Db::table($this->table)
->field("id,name")
->where($params)
->select();
//echo Db::table($this->table)->getLastSql();
return $result;
}
public function searchAgentsByKeyword($field, $params)
{
......
......@@ -87,7 +87,7 @@ class TAgentTotalModel extends Model
->group($group_)
->order($order)
->select();
//echo $this->db_->getLastSql();
// echo $this->db_->getLastSql();
return $result;
}
......
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