Commit 6dacdc6b authored by zw's avatar zw

个人中心升级看铺数

parent 7a372469
<?php
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\api_broker\service\LookShopService;
use app\model\AAgents;
use think\Request;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/5/8
* Time : 上午11:29
* Intro:
*/
class LookShop extends Basic{
protected $lookShopService_ ;
protected $agentsModel;
function __construct(Request $request = null)
{
parent::__construct($request);
$this->lookShopService_ = new LookShopService();
$this->agentsModel = new AAgents();
}
/**
* 升级经纪人的看铺数量
* @return \think\Response
*/
public function setAgentLookNum(){
$params = $this->params;
/* $params = array(
"agent_id" => 1,
"submit_agent_id" => 1,
);*/
if(!isset($params["agent_id"]) || !isset($params["submit_agent_id"])){
return $this->response("101","请求参数错误");
}
//todo 验证申请提交人和此经纪人是否是所属关系
$is_ok = $this->lookShopService_->setAgentLookNum($params["agent_id"]);
if($is_ok){
return $this->response("200","request success",[]);
}else{
return $this->response("101","升级看铺数量失败");
}
}
/**
* 经纪人列表
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentsResidueNumList(){
$params = $this->params;
/* $params = array(
"store_id" => 1,
);*/
if(!isset($params["store_id"])){
return $this->response("101","请求参数错误");
}
$field = "id,store_id,level,name,phone,img";
$where_["store_id"] = $params["store_id"];
$where_["status"] = 0;
$where_["level"] = 10;
$agentList = $this->agentsModel->getAgentById($field,$where_);
if(count($agentList) <= 0){
return $this->response("101","request null");
}
foreach ($agentList as $key=>$item){
$residue_num = $this->lookShopService_->isLookShop($item["id"]);
if($residue_num <= 0){
$agentList[$key]["is_show_button"] = true;
}else{
$agentList[$key]["is_show_button"] = false;
}
}
return $this->response("200","request success",$agentList);
}
}
\ No newline at end of file
...@@ -156,9 +156,9 @@ class OrderLog extends Basic ...@@ -156,9 +156,9 @@ class OrderLog extends Basic
} }
$is_ok = $this->service_->updateBillInfo($params["p_id"],$params["trade_no"],$params["pay_time"],$params["real_money"]); $is_ok = $this->service_->updateBillInfo($params["p_id"],$params["trade_no"],$params["pay_time"],$params["real_money"]);
if($is_ok > 0){ if($is_ok > 0){
return $this->response("200","request update success"); return $this->response("200","支付成功!");
}else{ }else{
return $this->response("101","update faild"); return $this->response("101","支付失败!");
} }
} }
......
...@@ -285,6 +285,16 @@ class AAgents extends BaseModel ...@@ -285,6 +285,16 @@ class AAgents extends BaseModel
if (isset($params["agent_id"])) { if (isset($params["agent_id"])) {
$where_["id"] = $params["agent_id"]; $where_["id"] = $params["agent_id"];
} }
if (isset($params["store_id"])) {
$where_["store_id"] = $params["store_id"];
}
if (isset($params["status"])) {
$where_["status"] = $params["status"];
}
if (isset($params["level"])) {
$where_["level"] = $params["level"];
}
$result = $this->field($field) $result = $this->field($field)
->where($where_) ->where($where_)
......
...@@ -427,6 +427,11 @@ Route::group('broker', [ ...@@ -427,6 +427,11 @@ Route::group('broker', [
'getAgentsResidueNumList' => ['api_broker/LookShop/getAgentsResidueNumList', [ 'method' => 'get' ] ], //剩余铺数列表
'setAgentLookNum' => ['api_broker/LookShop/setAgentLookNum', [ 'method' => 'post' ] ], //设置经纪人的看铺数量
]); ]);
//Route::miss('api/index/miss');//处理错误的url //Route::miss('api/index/miss');//处理错误的url
\ No newline at end of file
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