Commit fe024367 authored by clone's avatar clone

1

parent 928a3d19
......@@ -5,6 +5,7 @@ namespace app\index\controller;
use app\index\extend\Basic;
use app\api_broker\service\DailyPaperService;
use app\model\ODaily;
use app\model\ODailyLog;
use think\Request;
/**
......@@ -111,8 +112,8 @@ class DailyPaper extends Basic
$bank_card_new = $params["bank_card_new"] ? $params["bank_card_new"] : 0;
$site_id = $this->siteId;
$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
,$bank_card_lin,$bank_card_new);
$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);
if ($result["code"] == 101) {
return $this->response("101", $result["msg"]);
} else {
......@@ -127,7 +128,8 @@ class DailyPaper extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function commitCheck(){
public function commitCheck()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/*$params = array(
......@@ -149,7 +151,7 @@ class DailyPaper extends Basic
"bank_card_new"=>"123123"
);*/
$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)) {
return $this->response(101, '没有该记录,审核失败');
......@@ -182,12 +184,12 @@ class DailyPaper extends Basic
$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_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", "审核状态错误");
}
$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,
$bank_card_yun ,$bank_card_lin,$bank_card_new);
$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,
$bank_card_yun, $bank_card_lin, $bank_card_new);
if ($result["code"] == 101) {
return $this->response("101", $result["msg"]);
} else {
......@@ -199,24 +201,73 @@ class DailyPaper extends Basic
/**
* @return \think\Response
*/
public function getPayLogImg(){
public function getPayLogImg()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"pay_log_id" => 1
);*/
if(!isset($params["pay_log_id"])){
if (!isset($params["pay_log_id"])) {
return $this->response("101", "请求参数错误");
}
$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_info"] = $img_list;
return $this->response("200","success",$result);
}else{
return $this->response("200","request null");
return $this->response("200", "success", $result);
} else {
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
if(isset($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"])){
$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