|
|
@ -101,133 +101,184 @@ class AggregateFinanceSetController extends Controller {
|
|
|
|
$this->getAndSaveData(2,$begintime,$endtime);
|
|
|
|
$this->getAndSaveData(2,$begintime,$endtime);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
protected function getAndSaveData($type,$begintime,$endtime)
|
|
|
|
protected function getAndSaveData($type,$begintime,$endtime)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$sign = md5($begintime.$endtime.$type.$this->token);
|
|
|
|
$sign = md5($begintime.$endtime.$type.$this->token);
|
|
|
|
$arr = [
|
|
|
|
$arr = [
|
|
|
|
"begintime"=>$begintime,
|
|
|
|
"begintime"=>$begintime,
|
|
|
|
"endtime"=>$endtime,
|
|
|
|
"endtime"=>$endtime,
|
|
|
|
"type"=>$type,
|
|
|
|
"type"=>$type,
|
|
|
|
"sign"=>$sign
|
|
|
|
"sign"=>$sign
|
|
|
|
];
|
|
|
|
];
|
|
|
|
$dataurl .= $this->apihost."&".http_build_query($arr);
|
|
|
|
$dataurl .= $this->apihost."&".http_build_query($arr);
|
|
|
|
$html = file_get_contents($dataurl);
|
|
|
|
$html = file_get_contents($dataurl);
|
|
|
|
$rsp = json_decode($html,true);
|
|
|
|
// echo $dataurl;die();
|
|
|
|
if($rsp['code'] != 1){
|
|
|
|
sleep(5);
|
|
|
|
echo $rsp['error'].PHP_EOL;die;
|
|
|
|
$rsp = json_decode($html,true);
|
|
|
|
}
|
|
|
|
if($rsp['code'] != 1){
|
|
|
|
//成功插入
|
|
|
|
echo $rsp['error'].PHP_EOL;die;
|
|
|
|
$Aggregate = M("aggregate_statement","tab_");
|
|
|
|
}
|
|
|
|
$begintimestr = date("Y-m-d",$begintime);
|
|
|
|
//成功插入
|
|
|
|
$endtimestr = date("Y-m-d",$endtime);
|
|
|
|
$Aggregate = M("aggregate_statement","tab_");
|
|
|
|
if($rsp['count'] > 0){
|
|
|
|
$begintimestr = date("Y-m-d",$begintime);
|
|
|
|
//插入数据
|
|
|
|
$endtimestr = date("Y-m-d",$endtime);
|
|
|
|
foreach ($rsp['data'] as $k => $v) {
|
|
|
|
if($rsp['count'] > 0){
|
|
|
|
foreach ($v["game_list"] as $ke => &$va) {
|
|
|
|
//插入数据
|
|
|
|
$va['begintime'] = $begintimestr;
|
|
|
|
foreach ($rsp['data'] as $k => $v) {
|
|
|
|
$va['endtime'] = $endtimestr;
|
|
|
|
foreach ($v["game_list"] as $ke => &$va) {
|
|
|
|
$va['fax_ratio'] = 0;
|
|
|
|
$va['begintime'] = $begintimestr;
|
|
|
|
}
|
|
|
|
$va['endtime'] = $endtimestr;
|
|
|
|
$v["statement_info"] = json_encode($v["game_list"],JSON_UNESCAPED_UNICODE);
|
|
|
|
$va['fax_ratio'] = 0;
|
|
|
|
unset($v["game_list"]);
|
|
|
|
}
|
|
|
|
$v['begintime'] = $begintime;
|
|
|
|
$v["statement_info"] = json_encode($v["game_list"],JSON_UNESCAPED_UNICODE);
|
|
|
|
$v['endtime'] = $endtime;
|
|
|
|
unset($v["game_list"]);
|
|
|
|
$v['create_time'] = time();
|
|
|
|
$v['begintime'] = $begintime;
|
|
|
|
$v['admin_name'] = "system";
|
|
|
|
$v['endtime'] = $endtime;
|
|
|
|
$v['admin_id'] = 0;
|
|
|
|
$v['create_time'] = time();
|
|
|
|
$v['second_party_info'] = json_encode([
|
|
|
|
$v['admin_name'] = "system";
|
|
|
|
"partner"=>$v['channel_name']
|
|
|
|
$v['admin_id'] = 0;
|
|
|
|
],JSON_UNESCAPED_UNICODE);
|
|
|
|
$v['second_party_info'] =
|
|
|
|
$Aggregate->add($v);
|
|
|
|
json_encode([
|
|
|
|
}
|
|
|
|
"partner"=>$v['channel_name'],
|
|
|
|
}
|
|
|
|
"invoice_type"=>$v['invoice_type'],
|
|
|
|
|
|
|
|
"invoice_item"=>$v['invoice_item'],
|
|
|
|
if($type == 0){
|
|
|
|
"company_tax_no"=>$v['tax_identification_number'],
|
|
|
|
echo "----周结统计ok".PHP_EOL;
|
|
|
|
"link_man"=>$v['connection_person'],
|
|
|
|
}elseif($type == 1){
|
|
|
|
"link_phone"=>$v['phone'],
|
|
|
|
echo "----月结统计ok".PHP_EOL;
|
|
|
|
"address"=>$v['send_address'],
|
|
|
|
}elseif($type == 2){
|
|
|
|
"register_address"=>$v['register_address'],
|
|
|
|
echo "----补点统计ok".PHP_EOL;
|
|
|
|
"register_phone"=>$v['register_phone'],
|
|
|
|
}
|
|
|
|
"payee_name"=>$v['bank_user'],
|
|
|
|
}
|
|
|
|
"bank_account"=>$v['bank_card'],
|
|
|
|
|
|
|
|
"opening_bank"=>$v['bank_name'],
|
|
|
|
|
|
|
|
],JSON_UNESCAPED_UNICODE);
|
|
|
|
|
|
|
|
$Aggregate->add($v);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($type == 0){
|
|
|
|
|
|
|
|
echo "----周结统计ok".PHP_EOL;
|
|
|
|
|
|
|
|
}elseif($type == 1){
|
|
|
|
|
|
|
|
echo "----月结统计ok".PHP_EOL;
|
|
|
|
|
|
|
|
}elseif($type == 2){
|
|
|
|
|
|
|
|
echo "----补点统计ok".PHP_EOL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 重算聚合接口数据
|
|
|
|
* 重算聚合接口数据
|
|
|
|
* @param [type] $id
|
|
|
|
* @param [type] $id
|
|
|
|
* @return void
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function updateAggregateFinanceData($id)
|
|
|
|
public function updateAggregateFinanceData($id)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//获取基础信息
|
|
|
|
//获取基础信息
|
|
|
|
$Aggregate = M("aggregate_statement","tab_");
|
|
|
|
$Aggregate = M("aggregate_statement","tab_");
|
|
|
|
$info = $Aggregate->where("id='{$id}'")->find();
|
|
|
|
$info = $Aggregate->where("id='{$id}'")->find();
|
|
|
|
$sign = md5($info['begintime'].$info['endtime'].$info['withdraw_type'].$this->token);
|
|
|
|
$sign = md5($info['begintime'].$info['endtime'].$info['withdraw_type'].$this->token);
|
|
|
|
$arr = [
|
|
|
|
$arr = [
|
|
|
|
"begintime"=>$info['begintime'],
|
|
|
|
"begintime"=>$info['begintime'],
|
|
|
|
"endtime"=>$info['endtime'],
|
|
|
|
"endtime"=>$info['endtime'],
|
|
|
|
"type"=>$info['withdraw_type'],
|
|
|
|
"type"=>$info['withdraw_type'],
|
|
|
|
"sign"=>$sign,
|
|
|
|
"sign"=>$sign,
|
|
|
|
"channel_id"=>$info['channel_id']
|
|
|
|
"channel_id"=>$info['channel_id']
|
|
|
|
];
|
|
|
|
];
|
|
|
|
$dataurl .= $this->apihost."&".http_build_query($arr);
|
|
|
|
$dataurl .= $this->apihost."&".http_build_query($arr);
|
|
|
|
$html = file_get_contents($dataurl);
|
|
|
|
$html = file_get_contents($dataurl);
|
|
|
|
$rsp = json_decode($html,true);
|
|
|
|
$rsp = json_decode($html,true);
|
|
|
|
if($rsp['code'] != 1){
|
|
|
|
if($rsp['code'] != 1){
|
|
|
|
echo $rsp['error'].PHP_EOL;die;
|
|
|
|
echo $rsp['error'].PHP_EOL;die;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//更新信息
|
|
|
|
//更新信息
|
|
|
|
$begintimestr = date("Y-m-d",$info['begintime']);
|
|
|
|
$begintimestr = date("Y-m-d",$info['begintime']);
|
|
|
|
$endtimestr = date("Y-m-d",$info['endtime']);
|
|
|
|
$endtimestr = date("Y-m-d",$info['endtime']);
|
|
|
|
|
|
|
|
|
|
|
|
if($rsp['count'] > 0){
|
|
|
|
|
|
|
|
//插入数据
|
|
|
|
|
|
|
|
foreach ($rsp['data'] as $k => $v) {
|
|
|
|
|
|
|
|
foreach ($v["game_list"] as $ke => &$va) {
|
|
|
|
|
|
|
|
$va['begintime'] = $begintimestr;
|
|
|
|
|
|
|
|
$va['endtime'] = $endtimestr;
|
|
|
|
|
|
|
|
$va['fax_ratio'] = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$v["statement_info"] = json_encode($v["game_list"],JSON_UNESCAPED_UNICODE);
|
|
|
|
|
|
|
|
unset($v["game_list"]);
|
|
|
|
|
|
|
|
$v['create_time'] = time();
|
|
|
|
|
|
|
|
$v['admin_name'] = $_SESSION['onethink_admin']['user_auth']['username'];
|
|
|
|
|
|
|
|
$v['admin_id'] = $_SESSION['onethink_admin']['user_auth']['uid'];
|
|
|
|
|
|
|
|
$v['verify_status'] = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$first_party_info = json_decode($info['first_party_info'], 1);
|
|
|
|
|
|
|
|
if($first_party_info['partner'] == $info['channel_name']){
|
|
|
|
|
|
|
|
$v['second_party_info'] = $info['first_party_info'];
|
|
|
|
|
|
|
|
$v['first_party_info'] = $info['second_party_info'];
|
|
|
|
|
|
|
|
$v['pay_type'] =0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$res = $Aggregate->where("id='{$id}'")->save($v);
|
|
|
|
|
|
|
|
if(empty($res)){
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
$savedata = [
|
|
|
|
|
|
|
|
"create_time"=>time(),
|
|
|
|
|
|
|
|
"admin_name"=>$_SESSION['onethink_admin']['user_auth']['username'],
|
|
|
|
|
|
|
|
"admin_id"=>$_SESSION['onethink_admin']['user_auth']['uid'],
|
|
|
|
|
|
|
|
"verify_status"=>0,
|
|
|
|
|
|
|
|
"statement_info"=>json_encode([],JSON_UNESCAPED_UNICODE),
|
|
|
|
|
|
|
|
"ratio_money"=>0,
|
|
|
|
|
|
|
|
"pay_money"=>0
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$first_party_info = json_decode($info['first_party_info'], 1);
|
|
|
|
|
|
|
|
if($first_party_info['partner'] == $info['channel_name']){
|
|
|
|
|
|
|
|
$savedata['second_party_info'] = $info['first_party_info'];
|
|
|
|
|
|
|
|
$savedata['first_party_info'] = $info['second_party_info'];
|
|
|
|
|
|
|
|
$savedata['pay_type'] =0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$res = $Aggregate->where("id='{$id}'")->save($savedata);
|
|
|
|
if($rsp['count'] > 0){
|
|
|
|
if(empty($res)){
|
|
|
|
//插入数据
|
|
|
|
return false;
|
|
|
|
foreach ($rsp['data'] as $k => $v) {
|
|
|
|
}
|
|
|
|
foreach ($v["game_list"] as $ke => &$va) {
|
|
|
|
}
|
|
|
|
$va['begintime'] = $begintimestr;
|
|
|
|
return true;
|
|
|
|
$va['endtime'] = $endtimestr;
|
|
|
|
}
|
|
|
|
$va['fax_ratio'] = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$v["statement_info"] = json_encode($v["game_list"],JSON_UNESCAPED_UNICODE);
|
|
|
|
|
|
|
|
unset($v["game_list"]);
|
|
|
|
|
|
|
|
$v['create_time'] = time();
|
|
|
|
|
|
|
|
$v['admin_name'] = $_SESSION['onethink_admin']['user_auth']['username'];
|
|
|
|
|
|
|
|
$v['admin_id'] = $_SESSION['onethink_admin']['user_auth']['uid'];
|
|
|
|
|
|
|
|
$v['verify_status'] = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// $first_party_info = json_decode($info['first_party_info'], 1);
|
|
|
|
|
|
|
|
// if($first_party_info['partner'] == $info['channel_name']){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$v['second_party_info'] =
|
|
|
|
|
|
|
|
json_encode([
|
|
|
|
|
|
|
|
"partner"=>$v['channel_name'],
|
|
|
|
|
|
|
|
"invoice_type"=>$v['invoice_type'],
|
|
|
|
|
|
|
|
"invoice_item"=>$v['invoice_item'],
|
|
|
|
|
|
|
|
"company_tax_no"=>$v['tax_identification_number'],
|
|
|
|
|
|
|
|
"link_man"=>$v['connection_person'],
|
|
|
|
|
|
|
|
"link_phone"=>$v['phone'],
|
|
|
|
|
|
|
|
"address"=>$v['send_address'],
|
|
|
|
|
|
|
|
"register_address"=>$v['register_address'],
|
|
|
|
|
|
|
|
"register_phone"=>$v['register_phone'],
|
|
|
|
|
|
|
|
"payee_name"=>$v['bank_user'],
|
|
|
|
|
|
|
|
"bank_account"=>$v['bank_card'],
|
|
|
|
|
|
|
|
"opening_bank"=>$v['bank_name'],
|
|
|
|
|
|
|
|
],JSON_UNESCAPED_UNICODE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$v['first_party_info'] = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$v['pay_type'] =0;
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// $v['second_party_info'] =
|
|
|
|
|
|
|
|
// json_encode([
|
|
|
|
|
|
|
|
// "partner"=>$v['channel_name'],
|
|
|
|
|
|
|
|
// "invoice_type"=>$v['invoice_type'],
|
|
|
|
|
|
|
|
// "invoice_item"=>$v['invoice_item'],
|
|
|
|
|
|
|
|
// "company_tax_no"=>$v['tax_identification_number'],
|
|
|
|
|
|
|
|
// "link_man"=>$v['connection_person'],
|
|
|
|
|
|
|
|
// "link_phone"=>$v['phone'],
|
|
|
|
|
|
|
|
// "address"=>$v['send_address'],
|
|
|
|
|
|
|
|
// "register_address"=>$v['register_address'],
|
|
|
|
|
|
|
|
// "register_phone"=>$v['register_phone'],
|
|
|
|
|
|
|
|
// "payee_name"=>$v['bank_user'],
|
|
|
|
|
|
|
|
// "bank_account"=>$v['bank_card'],
|
|
|
|
|
|
|
|
// "opening_bank"=>$v['bank_name'],
|
|
|
|
|
|
|
|
// ],JSON_UNESCAPED_UNICODE);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// $v['pay_type'] =1;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$res = $Aggregate->where("id='{$id}'")->save($v);
|
|
|
|
|
|
|
|
if(empty($res)){
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
$savedata = [
|
|
|
|
|
|
|
|
"create_time"=>time(),
|
|
|
|
|
|
|
|
"admin_name"=>$_SESSION['onethink_admin']['user_auth']['username'],
|
|
|
|
|
|
|
|
"admin_id"=>$_SESSION['onethink_admin']['user_auth']['uid'],
|
|
|
|
|
|
|
|
"verify_status"=>0,
|
|
|
|
|
|
|
|
"statement_info"=>json_encode([],JSON_UNESCAPED_UNICODE),
|
|
|
|
|
|
|
|
"ratio_money"=>0,
|
|
|
|
|
|
|
|
"pay_money"=>0
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$first_party_info = json_decode($info['first_party_info'], 1);
|
|
|
|
|
|
|
|
if($first_party_info['partner'] == $info['channel_name']){
|
|
|
|
|
|
|
|
$savedata['second_party_info'] = $info['first_party_info'];
|
|
|
|
|
|
|
|
$savedata['first_party_info'] = $info['second_party_info'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$savedata['pay_type'] =0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$res = $Aggregate->where("id='{$id}'")->save($savedata);
|
|
|
|
|
|
|
|
if(empty($res)){
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|