Commit fe024367 authored by clone's avatar clone

1

parent 928a3d19
...@@ -5,6 +5,7 @@ namespace app\index\controller; ...@@ -5,6 +5,7 @@ namespace app\index\controller;
use app\index\extend\Basic; use app\index\extend\Basic;
use app\api_broker\service\DailyPaperService; use app\api_broker\service\DailyPaperService;
use app\model\ODaily; use app\model\ODaily;
use app\model\ODailyLog;
use think\Request; use think\Request;
/** /**
...@@ -35,17 +36,17 @@ class DailyPaper extends Basic ...@@ -35,17 +36,17 @@ class DailyPaper extends Basic
{ {
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
"store_id" => 730,//门店id "store_id" => 730,//门店id
"is_store" => 0,//身份是否是店长,财务显示不一样 0店长 1财务 "is_store" => 0,//身份是否是店长,财务显示不一样 0店长 1财务
"daily_data" => "2018-12-18" "daily_data" => "2018-12-18"
); );
$this->userId = 5775;*/ $this->userId = 5775;*/
if (!isset($params["store_id"]) || !isset($params["is_store"]) || !isset($params["daily_data"])) { if (!isset($params["store_id"]) || !isset($params["is_store"]) || !isset($params["daily_data"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
$store_id = $params["store_id"]; $store_id = $params["store_id"];
$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->userId, $store_id, $is_store, $daily_data); $result = $this->service_->getDaily($this->userId, $store_id, $is_store, $daily_data);
...@@ -67,52 +68,52 @@ class DailyPaper extends Basic ...@@ -67,52 +68,52 @@ class DailyPaper extends Basic
{ {
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
"agent_id" => 5775,//经纪人id "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",//3000账号 "private_bank" => "55",//3000账号
"cash" => "666",//现金 "cash" => "666",//现金
"pos" => "777",//pos机 "pos" => "777",//pos机
"other_bank" => "888",//其他 "other_bank" => "888",//其他
"bank_card_yun" => "2323", "bank_card_yun" => "2323",
"bank_card_lin"=>"1213", "bank_card_lin"=>"1213",
"bank_card_new"=>"123123" "bank_card_new"=>"123123"
);*/ );*/
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"]) ||
!isset($params["family_pay"]) || !isset($params["private_bank"]) || !isset($params["cash"]) || !isset($params["family_pay"]) || !isset($params["private_bank"]) || !isset($params["cash"]) ||
!isset($params["pos"]) || !isset($params["other_bank"]) !isset($params["pos"]) || !isset($params["other_bank"])
// || !isset($params["bank_card_yun"]) || !isset($params["bank_card_lin"]) || !isset($params["bank_card_new"]) // || !isset($params["bank_card_yun"]) || !isset($params["bank_card_lin"]) || !isset($params["bank_card_new"])
) { ) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
$agent_id = $params["agent_id"]; $agent_id = $params["agent_id"];
$agent_name = $params["agent_name"]; $agent_name = $params["agent_name"];
$daily_date = $params["daily_date"]; $daily_date = $params["daily_date"];
$alipay = $params["alipay"]; $alipay = $params["alipay"];
$tenpay_2 = $params["tenpay_2"]; $tenpay_2 = $params["tenpay_2"];
$alipay_2 = $params["alipay_2"]; $alipay_2 = $params["alipay_2"];
$tenpay = $params["tenpay"]; $tenpay = $params["tenpay"];
$realty_pay = $params["realty_pay"]; $realty_pay = $params["realty_pay"];
$private_bank = $params["private_bank"]; $private_bank = $params["private_bank"];
$family_pay = $params["family_pay"]; $family_pay = $params["family_pay"];
$cash = $params["cash"]; $cash = $params["cash"];
$pos = $params["pos"]; $pos = $params["pos"];
$other_bank = $params["other_bank"]; $other_bank = $params["other_bank"];
$bank_card = $params["bank_card"]; $bank_card = $params["bank_card"];
$bank_card_yun = $params["bank_card_yun"] ? $params["bank_card_yun"] : 0; $bank_card_yun = $params["bank_card_yun"] ? $params["bank_card_yun"] : 0;
$bank_card_lin = $params["bank_card_lin"] ? $params["bank_card_lin"] : 0; $bank_card_lin = $params["bank_card_lin"] ? $params["bank_card_lin"] : 0;
$bank_card_new = $params["bank_card_new"] ? $params["bank_card_new"] : 0; $bank_card_new = $params["bank_card_new"] ? $params["bank_card_new"] : 0;
$site_id = $this->siteId; $site_id = $this->siteId;
$result = $this->service_->addDaily($agent_id, $agent_name, $daily_date, $alipay, $tenpay, $realty_pay, $result = $this->service_->addDaily($agent_id, $agent_name, $daily_date, $alipay, $tenpay, $realty_pay,
$family_pay,$private_bank ,$cash, $pos, $other_bank, $tenpay_2, $alipay_2, $site_id, $bank_card,$bank_card_yun $family_pay, $private_bank, $cash, $pos, $other_bank, $tenpay_2, $alipay_2, $site_id, $bank_card, $bank_card_yun
,$bank_card_lin,$bank_card_new); , $bank_card_lin, $bank_card_new);
if ($result["code"] == 101) { if ($result["code"] == 101) {
return $this->response("101", $result["msg"]); return $this->response("101", $result["msg"]);
} else { } else {
...@@ -127,7 +128,8 @@ class DailyPaper extends Basic ...@@ -127,7 +128,8 @@ class DailyPaper extends Basic
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function commitCheck(){ public function commitCheck()
{
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$params = $this->params; $params = $this->params;
/*$params = array( /*$params = array(
...@@ -148,8 +150,8 @@ class DailyPaper extends Basic ...@@ -148,8 +150,8 @@ class DailyPaper extends Basic
"bank_card_lin"=>"1213", "bank_card_lin"=>"1213",
"bank_card_new"=>"123123" "bank_card_new"=>"123123"
);*/ );*/
$m_daily = new ODaily(); $m_daily = new ODaily();
$daily_data = $m_daily->getDailyList('id,site_id',['id'=>$params['daily_id']],1,1); $daily_data = $m_daily->getDailyList('id,site_id', ['id' => $params['daily_id']], 1, 1);
if (empty($daily_data)) { if (empty($daily_data)) {
return $this->response(101, '没有该记录,审核失败'); return $this->response(101, '没有该记录,审核失败');
...@@ -163,31 +165,31 @@ class DailyPaper extends Basic ...@@ -163,31 +165,31 @@ class DailyPaper extends Basic
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
$daily_id = $params["daily_id"]; $daily_id = $params["daily_id"];
$agent_id = $params["agent_id"]; $agent_id = $params["agent_id"];
$agent_name = $params["agent_name"]; $agent_name = $params["agent_name"];
$alipay = $params["alipay"]; $alipay = $params["alipay"];
$tenpay = $params["tenpay"]; $tenpay = $params["tenpay"];
$realty_pay = $params["realty_pay"]; $realty_pay = $params["realty_pay"];
$private_bank = $params["private_bank"]; $private_bank = $params["private_bank"];
$family_pay = $params["family_pay"]; $family_pay = $params["family_pay"];
$cash = $params["cash"]; $cash = $params["cash"];
$pos = $params["pos"]; $pos = $params["pos"];
$other_bank = $params["other_bank"]; $other_bank = $params["other_bank"];
$remark = $params["remark"]; $remark = $params["remark"];
$operation_status = $params["operation_status"]; $operation_status = $params["operation_status"];
$tenpay_2 = $params["tenpay_2"]; $tenpay_2 = $params["tenpay_2"];
$alipay_2 = $params["alipay_2"]; $alipay_2 = $params["alipay_2"];
$bank_card = $params["bank_card"]; $bank_card = $params["bank_card"];
$bank_card_yun = $params["bank_card_yun"] ? $params["bank_card_yun"] : 0; $bank_card_yun = $params["bank_card_yun"] ? $params["bank_card_yun"] : 0;
$bank_card_lin = $params["bank_card_lin"] ? $params["bank_card_lin"] : 0; $bank_card_lin = $params["bank_card_lin"] ? $params["bank_card_lin"] : 0;
$bank_card_new = $params["bank_card_new"] ? $params["bank_card_new"] : 0; $bank_card_new = $params["bank_card_new"] ? $params["bank_card_new"] : 0;
if($operation_status != 0 && $operation_status != 1){ if ($operation_status != 0 && $operation_status != 1) {
return $this->response("101", "审核状态错误"); return $this->response("101", "审核状态错误");
} }
$result = $this->service_->addDailyCheck($daily_id,$agent_id, $agent_name, $alipay, $tenpay, $realty_pay, $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, $tenpay_2, $alipay_2, $bank_card, $family_pay, $private_bank, $cash, $pos, $other_bank, $remark, $operation_status, $tenpay_2, $alipay_2, $bank_card,
$bank_card_yun ,$bank_card_lin,$bank_card_new); $bank_card_yun, $bank_card_lin, $bank_card_new);
if ($result["code"] == 101) { if ($result["code"] == 101) {
return $this->response("101", $result["msg"]); return $this->response("101", $result["msg"]);
} else { } else {
...@@ -199,24 +201,73 @@ class DailyPaper extends Basic ...@@ -199,24 +201,73 @@ class DailyPaper extends Basic
/** /**
* @return \think\Response * @return \think\Response
*/ */
public function getPayLogImg(){ public function getPayLogImg()
{
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
"pay_log_id" => 1 "pay_log_id" => 1
);*/ );*/
if(!isset($params["pay_log_id"])){ if (!isset($params["pay_log_id"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
$img_list = $this->service_->getImgs($params["pay_log_id"]); $img_list = $this->service_->getImgs($params["pay_log_id"]);
if(count($img_list) > 0){ if (count($img_list) > 0) {
$result["img_path"] = CHAT_IMG_URL; $result["img_path"] = CHAT_IMG_URL;
$result["img_info"] = $img_list; $result["img_info"] = $img_list;
return $this->response("200","success",$result); return $this->response("200", "success", $result);
}else{ } else {
return $this->response("200","request null"); return $this->response("200", "request null");
}
}
/**
* 转为已审核的日报备份为图片
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function dailyBackImg()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
if (empty($params["daily_id"]) || empty($params["img"])) {
return $this->response("101", "参数错误");
} }
$daily_id = $params['daily_id'];
$m_daily = new ODailyLog();
$where_["daily_id"] = $daily_id;
$where_["operation_status"] = 1;
$where_["is_del"] = 0;
$daily_log_data = $m_daily->getDailyLogList('id', $where_, 1, 1);
if (count($daily_log_data) <= 0) {
return $this->response("101", "只有转为已审核的日报才能备份");
}
$img_title = $img = "";
$base64_image_content = $this->params["img"];
if (preg_match('/^(data:\s*image\/(\w+);base64,)/', $base64_image_content, $array)) {
$img_title = $array[2]; //jpeg
$img = base64_decode(str_replace($array[1], '', $base64_image_content)); //返回文件流
}
$tmp_file = time();
$img_name = md5(uniqid($tmp_file)) . '.' . $img_title;
$url = 'static/week_work_img/' . $img_name;
$img_url = "";
if (file_put_contents($url, $img)) {
$img_url = IMAGES_URL . $url;
$m_daily = new ODaily();
$m_daily->updateDaily(["id"=>$daily_id],["back_‭img"=>$img_url]);
} else{
return $this->response("101", "生成图片失败");
}
return $this->response("200", "success", ['img_url'=> $img_url]);
} }
} }
\ No newline at end of file
...@@ -41,6 +41,9 @@ class ODailyLog extends BaseModel ...@@ -41,6 +41,9 @@ class ODailyLog extends BaseModel
if(isset($params["operation_id"])){ if(isset($params["operation_id"])){
$where_["operation_id"] = $params["operation_id"]; $where_["operation_id"] = $params["operation_id"];
} }
if(isset($params["operation_status"])){
$where_["operation_status"] = $params["operation_status"];
}
if(isset($params["is_del"])){ if(isset($params["is_del"])){
$where_["is_del"] = $params["is_del"]; $where_["is_del"] = $params["is_del"];
} }
......
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