Commit 0e8c59f4 authored by clone's avatar clone

1

parent 6aef71c6
......@@ -2,11 +2,11 @@
# https://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
.baidu.com TRUE / FALSE 0 H_PS_PSSID 1453_21126_29238_28519_29099_28835_29221_29131
www.baidu.com FALSE / FALSE 0 BD_HOME 0
www.baidu.com FALSE / FALSE 0 BDSVRTM 11
.baidu.com TRUE / FALSE 0 delPer 0
.baidu.com TRUE / FALSE 3707813702 PSTM 1560330052
.baidu.com TRUE / FALSE 3707813702 BIDUPSID BDD7053CE9E9ADAE5E8E7F7532C4A7E9
.baidu.com TRUE / FALSE 3707813702 BAIDUID BDD7053CE9E9ADAE5E8E7F7532C4A7E9:FG=1
.www.haozu.com TRUE / FALSE 1575785417 1houseView %5B%7B%22viewId%22%3A%221173150%22%2C%22userId%22%3A0%2C%22circleId%22%3A%22178%22%2C%22streetId%22%3A%226081%22%2C%22districtId%22%3A%22191%22%2C%22cityId%22%3A%2213%22%2C%22type%22%3A2%2C%22category%22%3A1%2C%22viewTime%22%3A1560233406%7D%2C%7B%22viewId%22%3A%22992988%22%2C%22userId%22%3A0%2C%22circleId%22%3A%22216%22%2C%22streetId%22%3A%226071%22%2C%22districtId%22%3A%22195%22%2C%22cityId%22%3A%2213%22%2C%22type%22%3A2%2C%22category%22%3A1%2C%22viewTime%22%3A1560233407%7D%2C%7B%22viewId%22%3A%221107172%22%2C%22userId%22%3A0%2C%22circleId%22%3A%22226%22%2C%22streetId%22%3A%226039%22%2C%22districtId%22%3A%22200%22%2C%22cityId%22%3A%2213%22%2C%22type%22%3A2%2C%22category%22%3A1%2C%22viewTime%22%3A1560233408%7D%2C%7B%22viewId%22%3A%22555537%22%2C%22userId%22%3A0%2C%22circleId%22%3A%22216%22%2C%22streetId%22%3A%226071%22%2C%22districtId%22%3A%22195%22%2C%22cityId%22%3A%2213%22%2C%22type%22%3A2%2C%22category%22%3A1%2C%22viewTime%22%3A1560233409%7D%2C%7B%22viewId%22%3A%221285245%22%2C%22userId%22%3A0%2C%22circleId%22%3A%22216%22%2C%22streetId%22%3A%226071%22%2C%22districtId%22%3A%22195%22%2C%22cityId%22%3A%2213%22%2C%22type%22%3A2%2C%22category%22%3A1%2C%22viewTime%22%3A1560233410%7D%2C%7B%22viewId%22%3A%221346697%22%2C%22userId%22%3A0%2C%22circleId%22%3A%22338%22%2C%22streetId%22%3A%227251%22%2C%22districtId%22%3A%22197%22%2C%22cityId%22%3A%2213%22%2C%22type%22%3A2%2C%22category%22%3A1%2C%22viewTime%22%3A1560233411%7D%2C%7B%22viewId%22%3A%22714981%22%2C%22userId%22%3A0%2C%22circleId%22%3A%22216%22%2C%22streetId%22%3A%226071%22%2C%22districtId%22%3A%22195%22%2C%22cityId%22%3A%2213%22%2C%22type%22%3A2%2C%22category%22%3A1%2C%22viewTime%22%3A1560233412%7D%2C%7B%22viewId%22%3A%221103785%22%2C%22userId%22%3A0%2C%22circleId%22%3A%22216%22%2C%22streetId%22%3A%226071%22%2C%22districtId%22%3A%22195%22%2C%22cityId%22%3A%2213%22%2C%22type%22%3A2%2C%22category%22%3A1%2C%22viewTime%22%3A1560233413%7D%2C%7B%22viewId%22%3A%22101612%22%2C%22userId%22%3A0%2C%22circleId%22%3A%22338%22%2C%22streetId%22%3A%227251%22%2C%22districtId%22%3A%22197%22%2C%22cityId%22%3A%2213%22%2C%22type%22%3A2%2C%22category%22%3A1%2C%22viewTime%22%3A1560233414%7D%2C%7B%22viewId%22%3A%22464034%22%2C%22userId%22%3A0%2C%22circleId%22%3A%22225%22%2C%22streetId%22%3A%226027%22%2C%22districtId%22%3A%22200%22%2C%22cityId%22%3A%2213%22%2C%22type%22%3A2%2C%22category%22%3A1%2C%22viewTime%22%3A1560233415%7D%5D
.baidu.com TRUE / FALSE 3707813702 BAIDUID BDD7053CE9E9ADAE5E8E7F7532C4A7E9:FG=1
.baidu.com TRUE / FALSE 3707813702 BIDUPSID BDD7053CE9E9ADAE5E8E7F7532C4A7E9
.baidu.com TRUE / FALSE 3707813702 PSTM 1560330052
.baidu.com TRUE / FALSE 0 delPer 0
www.baidu.com FALSE / FALSE 0 BDSVRTM 11
www.baidu.com FALSE / FALSE 0 BD_HOME 0
.baidu.com TRUE / FALSE 0 H_PS_PSSID 1453_21126_29238_28519_29099_28835_29221_29131
......@@ -9,7 +9,7 @@ class OAmercementModel extends Model
{
// 设置当前模型对应的完整数据表名称
protected $table = 'o_amercement';
private $db_;
private $db_;
public function __construct($data = [])
{
......@@ -17,11 +17,12 @@ class OAmercementModel extends Model
$this->db_ = Db::name($this->table);
}
public function saveAmercement($data) {
$time = date("Y-m-d H:i:s", time());
public function saveAmercement($data)
{
$time = date("Y-m-d H:i:s", time());
$data['create_time'] = $time;
$data['update_time'] = $time;
$data['is_del'] = 0;
$data['is_del'] = 0;
return $this->db_->insertGetId($data);
}
......@@ -37,7 +38,7 @@ class OAmercementModel extends Model
public function getAmercementList($params, $field, $page_no, $page_size)
{
$params['is_del'] = 0;
$result = $this->db_
$result = $this->db_
->field($field)
->where($params)
->limit($page_size)
......@@ -50,7 +51,7 @@ class OAmercementModel extends Model
public function getAmercementListSum($params, $field)
{
$params['is_del'] = 0;
$result = $this->db_
$result = $this->db_
->where($params)
->sum($field);
return $result;
......@@ -89,6 +90,27 @@ class OAmercementModel extends Model
->select();
return $result;
}
public function getAmercementAndPayCount($params, $field)
{
return $this->db_
->alias("a")
->join("o_amercement_pay b", "a.id = b.amercement_id", "left")
->field($field)
->where($params)
->count();
}
public function getAmercementAndPayList($params, $field,$page_no,$page_size)
{
return $this->db_
->alias("a")
->join("o_amercement_pay b", "a.id = b.amercement_id", "left")
->field($field)
->limit($page_size)
->page($page_no)
->where($params)
->select();
}
/**更新数据
......@@ -99,7 +121,7 @@ class OAmercementModel extends Model
*/
public function updateAmercementData($params)
{
$return = $this->db_->update($params);
$return = $this->db_->update($params);
// big_log($this->getLastSql());
return $return;
}
......
......@@ -819,6 +819,8 @@ Route::group('task', [
'selectDailyUncommitted' => ['task/DailyUncommittedTask/selectDailyUncommitted', ['method' => 'get']], //未提交财务日报的门店
'saveLookUser' => ['task/SaveLookUserHistoryTask/saveLookUser', ['method' => 'get']], //保存经纪人看客户的记录
'getNoSettlementList' => ['task/AmercementTask/getNoSettlementList', ['method' => 'get']], //保存经纪人看客户的记录
]);
Route::group('broker', [
......
<?php
namespace app\task\controller;
use app\model\OAmercementModel;
/**
* Created by PhpStorm.
* User: zw
* Date: 2019/10/9
* Time: 10:22
*/
class AmercementTask
{
private $merid;
private $amercementModel;
public function __construct()
{
$this->amercementModel = new OAmercementModel();
if (CURRENT_URL == 'https://api.tonglianjituan.com/') {
$$this->merid = "1123123";
} else {
$this->merid = "CM2000738776";
}
}
public function getNoSettlementList()
{
$params["a.status"] = 1;
$params["a.is_del"] = 0;
$params["b.status"] = 1;
$params["b.id"] = array('exp', 'is not null');
$total = $this->amercementModel->getAmercementAndPayCount($params, "a.id,b.trade_no");
$pageSize = 20;
$pageTotal = ceil($total / $pageSize);
for ($pageNo = 1; $pageNo <= $pageTotal; $pageNo++) {
$amercementArr = $this->amercementModel->getAmercementAndPayList($params, "a.id,b.trade_no", $pageNo, $pageSize);
$tree = $tradeList = [];
foreach ($amercementArr as $item) {
$tree[$item["trade_no"]] = $item["id"];
array_push($tradeList, $item["trade_no"]);
}
$tradeList = json_encode($tradeList);
$arr["merid"] = $this->merid;
$arr["tranflows"] = $tradeList;
$this->getSettlementStatus($arr, $tree);
}
}
private function getSettlementStatus($arr, $tree)
{
$data = json_encode($arr);
$curl = new \app\chat\utils\CurlUtil();
$curl->headers = [
"Accept" => "application/json",
"Content-Type" => "application/json;charset=utf-8",
];
$curl->options = [
"CURLOPT_SSL_VERIFYPEER" => 0,
"CURLOPT_SSL_VERIFYHOST" => 2,
];
$url = $this->buildSendUrl();
$response = $curl->post($url, $data);
$result = json_decode($response, true);
if ($result && $result["code"] == 0) {
foreach ($result["data"] as $key => $item) {
if ($item["is_settlement"] == 1) {//等于1为已结算,修改表状态
$updateParams["id"] = $tree[$item["tranflow"]];
$updateParams["is_settlement"] = 1;
$this->amercementModel->updateAmercementData($updateParams);
}
}
} else {
return false;
}
}
/**
* 请求api
* @return string
*/
private function buildSendUrl()
{
return "http://120.55.43.9/api/sett_result";
}
}
\ 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