Commit 321e53ef authored by zw's avatar zw

新增提交

parent 7f8188a8
...@@ -62,7 +62,7 @@ class DailyPaperService ...@@ -62,7 +62,7 @@ class DailyPaperService
$result["is_commit"] = 1; $result["is_commit"] = 1;
switch ($is_store) { switch ($is_store) {
case 0: case 0:
if ($agent_info["level"] != 20 && $agent_info["level"] != 30) { if ($agent_info["level"] != 20 && $agent_info["level"] != 40) {
return ["code" => 101, "msg" => "非店长不能查看日报"]; return ["code" => 101, "msg" => "非店长不能查看日报"];
} }
//证明店长提交过 //证明店长提交过
...@@ -370,7 +370,7 @@ class DailyPaperService ...@@ -370,7 +370,7 @@ class DailyPaperService
$agent_info_field = "id,name,store_id,district_id,level"; $agent_info_field = "id,name,store_id,district_id,level";
$agent_info = $this->aAgentsModel->getAgentById($agent_info_field, $agent_info_arr); $agent_info = $this->aAgentsModel->getAgentById($agent_info_field, $agent_info_arr);
if (count($agent_info) <= 0) { if (count($agent_info) <= 0 || ($agent_info[0]["level"] !=20 && $agent_info[0]["level"] !=40)) {
return ["code" => 101, "msg" => "经纪人信息错误"]; return ["code" => 101, "msg" => "经纪人信息错误"];
} }
$params = $this->dailyBin($agent_id, $agent_name, $daily_date, $alipay, $tenpay, $realty_pay, $params = $this->dailyBin($agent_id, $agent_name, $daily_date, $alipay, $tenpay, $realty_pay,
...@@ -399,6 +399,63 @@ class DailyPaperService ...@@ -399,6 +399,63 @@ class DailyPaperService
return $arr; return $arr;
} }
/**
* @param $daily_id
* @param $agent_id
* @param $agent_name
* @param $daily_date
* @param $alipay
* @param $tenpay
* @param $realty_pay
* @param $family_pay
* @param $private_bank
* @param $cash
* @param $pos
* @param $other_bank
* @param $remark
* @return array|int
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function addDailyCheck($daily_id, $agent_id, $agent_name, $daily_date, $alipay, $tenpay, $realty_pay,
$family_pay, $private_bank, $cash, $pos, $other_bank, $remark)
{
$agent_info_arr["agent_id"] = $agent_id;
$agent_info_field = "id,name,store_id,district_id,level";
$agent_info = $this->aAgentsModel->getAgentById($agent_info_field, $agent_info_arr);
if (count($agent_info) <= 0 || ($agent_info[0]["level"] != 20 && $agent_info[0]["level"] != 40)) {
return ["code" => 101, "msg" => "经纪人信息错误"];
}
$params = $this->dailyLogBin($daily_id, $agent_id, $agent_name, $daily_date, $alipay, $tenpay, $realty_pay,
$family_pay, $private_bank, $cash, $pos, $other_bank, $agent_info[0]["store_id"], $agent_info[0]["district_id"], $remark);
return $this->oDailyModel->addDaily($params);
}
public function dailyLogBin($daily_id,$agent_id, $agent_name, $daily_date, $alipay, $tenpay, $realty_pay,
$family_pay, $private_bank,$cash, $pos, $other_bank,$store_id,$district_id,$remark)
{
$arr["daily_id"] = $daily_id;
$arr["operation_id"] = $agent_id;
$arr["operation_name"] = $agent_name;
$arr["store_id"] = $store_id;
$arr["district_id"] = $district_id;
$arr["daily_date"] = $daily_date;
$arr["alipay"] = $alipay;
$arr["tenpay"] = $tenpay;
$arr["realty_pay"] = $realty_pay;
$arr["family_pay"] = $family_pay;
$arr["private_bank"] = $private_bank;
$arr["cash"] = $cash;
$arr["pos"] = $pos;
$arr["other_bank"] = $other_bank;
$arr["create_time"] = date("Y-m-d H:i:s",time());
$arr["update_time"] = date("Y-m-d H:i:s",time());
return $arr;
}
/** /**
* 获取提交的日报记录 * 获取提交的日报记录
* @param $agent_id * @param $agent_id
......
...@@ -46,7 +46,7 @@ class DailyPaper extends Basic ...@@ -46,7 +46,7 @@ class DailyPaper extends Basic
$is_store = $params["is_store"]; $is_store = $params["is_store"];
$daily_data = $params["daily_data"]; $daily_data = $params["daily_data"];
$result = $this->service_->getDaily($this->agentId, $store_id, $is_store, $daily_data); $result = $this->service_->getDaily($this->userId, $store_id, $is_store, $daily_data);
if ($result["code"] == 101) { if ($result["code"] == 101) {
return $this->response("101", $result["msg"]); return $this->response("101", $result["msg"]);
} else { } else {
...@@ -54,21 +54,28 @@ class DailyPaper extends Basic ...@@ -54,21 +54,28 @@ class DailyPaper extends Basic
} }
} }
/**
* 店长提交财务日报
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function addDaily() public function addDaily()
{ {
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
"agent_id" => 5775, "agent_id" => 5775,//经纪人id
"agent_name" => "222", "agent_name" => "222",//经纪人姓名
"daily_date" => "2018-12-02", "daily_date" => "2018-12-02",//日报日期
"alipay" => "12", "alipay" => "12",//支付宝收款
"tenpay" => "2323", "tenpay" => "2323",//微信收款
"realty_pay" => "232", "realty_pay" => "232",//地产转帐
"family_pay" => "444", "family_pay" => "444",//世家公账
"private_bank" => "55", "private_bank" => "55",//3000账号
"cash" => "666", "cash" => "666",//现金
"pos" => "777", "pos" => "777",//pos机
"other_bank" => "888" "other_bank" => "888"//其他
);*/ );*/
if (empty($params["agent_id"]) || empty($params["agent_name"]) || empty($params["daily_date"]) || 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["alipay"]) || !isset($params["tenpay"]) || !isset($params["realty_pay"]) ||
...@@ -98,4 +105,72 @@ class DailyPaper extends Basic ...@@ -98,4 +105,72 @@ class DailyPaper extends Basic
} }
} }
public function commitCheck(){
$params = $this->params;
/**
* CREATE TABLE `o_daily_log` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '财务日报审核日志',
`daily_id` int(10) unsigned DEFAULT NULL COMMENT '财务日报id',
`operation_id` int(10) unsigned DEFAULT NULL COMMENT '审核人',
`operation_name` varchar(60) DEFAULT '' COMMENT '审核人名字',
`remark` varchar(255) DEFAULT '' COMMENT '备注',
`alipay` decimal(10,2) DEFAULT '0.00' COMMENT '支付宝转账',
`tenpay` decimal(10,2) DEFAULT '0.00' COMMENT '微信转账',
`realty_pay` decimal(10,2) unsigned DEFAULT '0.00' COMMENT '地产转账',
`family_pay` decimal(10,2) unsigned DEFAULT '0.00' COMMENT '世家公账',
`private_bank` decimal(10,2) unsigned DEFAULT '0.00' COMMENT '3000账号',
`cash` decimal(10,2) unsigned DEFAULT '0.00' COMMENT '现金',
`pos` decimal(10,2) unsigned DEFAULT '0.00' COMMENT 'pos机',
`other_bank` decimal(10,2) DEFAULT '0.00' COMMENT '其他',
`is_del` tinyint(1) unsigned DEFAULT '0' COMMENT '0正常1删除',
`status` tinyint(1) unsigned DEFAULT '0' COMMENT '审核状态0已提交 1未审核 2已审核',
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
*/
/* $params = array(
"daily_id" => 1,
"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"//其他,
"remark" => "888"//其他,
);*/
if (!isset($params["daily_id"]) || 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", "请求参数错误");
}
$daily_id = $params["daily_id"];
$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["agent_id"];
$other_bank = $params["other_bank"];
$remark = $params["remark"];
$is_ok = $this->service_->addDailyCheck($daily_id,$agent_id, $agent_name, $daily_date, $alipay, $tenpay, $realty_pay,
$family_pay,$private_bank ,$cash, $pos, $other_bank,$remark);
if($is_ok > 0){
return $this->response("200","success",[]);
}else{
return $this->response("101", "保存数据异常");
}
}
} }
\ 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