Commit 42834ad0 authored by zw's avatar zw

tup

parent ce7f72d7
<?php
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\api_broker\service\DailyPaperService;
use think\Request;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/12/17
* Time : 11:09 AM
* Intro:
*/
class DailyPaper extends Basic
{
private $service_;
public function __construct(Request $request = null)
{
parent::__construct($request);
$this->service_ = new DailyPaperService();
}
/**
* 财务日报
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function dailyDetail()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"store_id" => 730,//门店id
"is_store" => 0,//身份是否是店长,财务显示不一样 0店长 1财务
"daily_data" => "2018-12-18"
);
$this->userId = 5775;*/
if (!isset($params["store_id"]) || !isset($params["is_store"]) || !isset($params["daily_data"])) {
return $this->response("101", "请求参数错误");
}
$store_id = $params["store_id"];
$is_store = $params["is_store"];
$daily_data = $params["daily_data"];
$result = $this->service_->getDaily($this->agentId, $store_id, $is_store, $daily_data);
if ($result["code"] == 101) {
return $this->response("101", $result["msg"]);
} else {
return $this->response("200", "success", $result["data"]);
}
}
/**
* 店长提交财务日报
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function addDaily()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"agent_id" => 5775,//经纪人id
"agent_name" => "222",//经纪人姓名
"daily_date" => "2018-12-02",//日报日期
"alipay" => "12",//支付宝收款
"tenpay" => "2323",//微信收款
"realty_pay" => "232",//地产转帐
"family_pay" => "444",//世家公账
"private_bank" => "55",//3000账号
"cash" => "666",//现金
"pos" => "777",//pos机
"other_bank" => "888"//其他
);*/
if (empty($params["agent_id"]) || empty($params["agent_name"]) || empty($params["daily_date"]) ||
!isset($params["alipay"]) || !isset($params["tenpay"]) || !isset($params["realty_pay"]) ||
!isset($params["family_pay"]) || !isset($params["private_bank"]) || !isset($params["cash"]) ||
!isset($params["pos"]) || !isset($params["other_bank"])
) {
return $this->response("101", "请求参数错误");
}
$agent_id = $params["agent_id"];
$agent_name = $params["agent_name"];
$daily_date = $params["daily_date"];
$alipay = $params["alipay"];
$tenpay = $params["tenpay"];
$realty_pay = $params["realty_pay"];
$private_bank = $params["private_bank"];
$family_pay = $params["family_pay"];
$cash = $params["cash"];
$pos = $params["pos"];
$other_bank = $params["other_bank"];
$result = $this->service_->addDaily($agent_id, $agent_name, $daily_date, $alipay, $tenpay, $realty_pay,
$family_pay,$private_bank ,$cash, $pos, $other_bank);
if ($result["code"] == 101) {
return $this->response("101", $result["msg"]);
} else {
return $this->response("200", "success", $result["data"]);
}
}
/**
* 财务审核新增
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function commitCheck(){
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/*$params = array(
"daily_id" => 1,//日报id
"agent_id" => 5775,//经纪人id
"agent_name" => "222",//经纪人姓名
"alipay" => "12",//支付宝收款
"tenpay" => "2323",//微信收款
"realty_pay" => "232",//地产转帐
"family_pay" => "444",//世家公账
"private_bank" => "55",//3000账号
"cash" => "666",//现金
"pos" => "777",//pos机
"other_bank" => "888",//其他,
"operation_status" => 1,//0审核通过 1转为已审核
"remark" => "888"//备注,
);*/
if (!isset($params["daily_id"]) || empty($params["agent_id"]) || empty($params["agent_name"]) ||
!isset($params["alipay"]) || !isset($params["tenpay"]) || !isset($params["realty_pay"]) ||
!isset($params["family_pay"]) || !isset($params["private_bank"]) || !isset($params["cash"]) ||
!isset($params["pos"]) || !isset($params["other_bank"]) || !isset($params["operation_status"])
) {
return $this->response("101", "请求参数错误");
}
$daily_id = $params["daily_id"];
$agent_id = $params["agent_id"];
$agent_name = $params["agent_name"];
$alipay = $params["alipay"];
$tenpay = $params["tenpay"];
$realty_pay = $params["realty_pay"];
$private_bank = $params["private_bank"];
$family_pay = $params["family_pay"];
$cash = $params["cash"];
$pos = $params["pos"];
$other_bank = $params["other_bank"];
$remark = $params["remark"];
$operation_status = $params["operation_status"];
if($operation_status != 0 && $operation_status != 1){
return $this->response("101", "审核状态错误");
}
$result = $this->service_->addDailyCheck($daily_id,$agent_id, $agent_name, $alipay, $tenpay, $realty_pay,
$family_pay,$private_bank ,$cash, $pos, $other_bank,$remark,$operation_status);
if ($result["code"] == 101) {
return $this->response("101", $result["msg"]);
} else {
return $this->response("200", "success", $result["data"]);
}
}
/**
* @return \think\Response
*/
public function getPayLogImg(){
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"pay_log_id" => 1
);*/
if(!isset($params["pay_log_id"])){
return $this->response("101", "请求参数错误");
}
$img_list = $this->service_->getImgs($params["pay_log_id"]);
if(count($img_list) > 0){
$result["img_path"] = CHAT_IMG_URL;
$result["img_info"] = $img_list;
return $this->response("200","success",$result);
}else{
return $this->response("200","request null");
}
}
}
\ No newline at end of file
......@@ -774,6 +774,12 @@ Route::group('broker', [
'addUserBind' => [ 'api_broker/User/addUserBind', [ 'method' => 'get|post' ] ],
'removeUserBind' => [ 'api_broker/User/removeUserBind', [ 'method' => 'get|post' ] ],
'dailyDetail' => ['api_broker/DailyPaper/dailyDetail', ['method' => 'get|post']],
'addDaily' => ['api_broker/DailyPaper/addDaily', ['method' => 'get|post']],
'commitCheck' => ['api_broker/DailyPaper/commitCheck', ['method' => 'get|post']],
'getPayLogImg' => ['api_broker/DailyPaper/getPayLogImg', ['method' => 'get|post']],
]);
//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