Commit c6f6a040 authored by wanjilong's avatar wanjilong

add: 梳理报错信息及文案

parent 5cba5d0c
...@@ -17,4 +17,5 @@ class Code ...@@ -17,4 +17,5 @@ class Code
const SDK = 104000; const SDK = 104000;
const FUNDS = 105000; const FUNDS = 105000;
const P_ACCOUNT = 106000; const P_ACCOUNT = 106000;
const MERCHANT = 107000;
} }
\ No newline at end of file
<?php
namespace App\Exception\custom;
use App\Exception\BaseException;
class MerchantException extends BaseException
{
protected $base_code = Code::MERCHANT;
protected $cus = [
0 => '系统异常请联系管理员',
1 => 'interface.ini 缺少配置,请管理员关注',
2 => 'account返回异常,请管理员关注',
];
}
...@@ -8,30 +8,4 @@ class PayOrder extends MysqlBase ...@@ -8,30 +8,4 @@ class PayOrder extends MysqlBase
{ {
const TABLE_NAME = 'pay_order'; const TABLE_NAME = 'pay_order';
const CONFIG_INDEX = 'pay'; const CONFIG_INDEX = 'pay';
/**
* @param $order_id
* @param $pay_order
* @return array
*/
public static function get_valid_order($order_id, $pay_order) {
self::beginTransaction();
try{
$order = self::getMaster('*', ['order_id'=>$order_id]);
if(empty($order)) {
$cnt = self::insert($pay_order, ['rowCount'=>true]);
if($cnt) {
$order = $pay_order;
}
}
self::commit();
}catch (\PDOException $e) {
self::rollback();
}
return $order;
}
} }
...@@ -448,7 +448,6 @@ class PayService ...@@ -448,7 +448,6 @@ class PayService
if(!empty($order_item_ids) && !in_array($item['order_item_id'], $order_item_ids)) { if(!empty($order_item_ids) && !in_array($item['order_item_id'], $order_item_ids)) {
continue; //部分核销,且不再核销子单列表,不处理 continue; //部分核销,且不再核销子单列表,不处理
} }
if(in_array($item['refund_order_status'], [1, 2])) { if(in_array($item['refund_order_status'], [1, 2])) {
continue; //退款中、已退款不允许再次申请 continue; //退款中、已退款不允许再次申请
} }
...@@ -546,7 +545,7 @@ class PayService ...@@ -546,7 +545,7 @@ class PayService
} }
*/ */
//平台收入入账 //平台收入入账
$p = WriteOffPlatformRecord::selectMaster('*', $p = WriteOffPlatformRecord::getMaster('*',
['writeoff_order_id'=>$writeOff_order_id, 'notify_account_status[<]'=>2]); ['writeoff_order_id'=>$writeOff_order_id, 'notify_account_status[<]'=>2]);
if($p) { if($p) {
$p_cnt = $p_cnt && PlatformAccountService::credit(['trade_id'=>$writeOff_order_id, 'amount'=>$p['payment']]); $p_cnt = $p_cnt && PlatformAccountService::credit(['trade_id'=>$writeOff_order_id, 'amount'=>$p['payment']]);
...@@ -557,7 +556,7 @@ class PayService ...@@ -557,7 +556,7 @@ class PayService
} }
//团长分销入账 //团长分销入账
$us = WriteOffPersonalRecord::getMaster('*', $us = WriteOffPersonalRecord::selectMaster('*',
['writeoff_order_id'=>$writeOff_order_id, 'notify_account_status[<]'=>2]); ['writeoff_order_id'=>$writeOff_order_id, 'notify_account_status[<]'=>2]);
if($us) { if($us) {
$w_list = []; $w_list = [];
...@@ -586,7 +585,7 @@ class PayService ...@@ -586,7 +585,7 @@ class PayService
} }
//商家收益 //商家收益
$m = WriteOffMerchantRecord::selectMaster('*', $m = WriteOffMerchantRecord::getMaster('*',
['writeoff_order_id'=>$writeOff_order_id, 'notify_account_status[<]'=>2]); ['writeoff_order_id'=>$writeOff_order_id, 'notify_account_status[<]'=>2]);
if($m) { if($m) {
try{ //MerchantAccountService try{ //MerchantAccountService
...@@ -620,12 +619,12 @@ class PayService ...@@ -620,12 +619,12 @@ class PayService
], ['writeoff_order_id'=>$writeOff_order_id, 'notify_account_status'=>1]); ], ['writeoff_order_id'=>$writeOff_order_id, 'notify_account_status'=>1]);
} else { } else {
$info = WriteOffOrder::selectMaster('*', ['writeoff_order_id'=>$writeOff_order_id]); $info = WriteOffOrder::getMaster('*', ['writeoff_order_id'=>$writeOff_order_id]);
$next = $this->getNextTime($info['can_notify_account_time']); $next = $this->getNextTime($info['notify_account_times']);
WriteOffOrder::update([ WriteOffOrder::update([
'notify_account_status'=>0, 'notify_account_status'=>0,
'can_notify_account_time[+]'=>1, 'notify_account_times[+]'=>1,
'notify_account_times'=>date('Y-m-d H:i:s', $next), 'can_notify_account_time'=>date('Y-m-d H:i:s', $next),
], ['writeoff_order_id'=>$writeOff_order_id]); ], ['writeoff_order_id'=>$writeOff_order_id]);
} }
} }
...@@ -985,10 +984,11 @@ class PayService ...@@ -985,10 +984,11 @@ class PayService
* @param $merchant_cash * @param $merchant_cash
* @return mixed * @return mixed
* 计算商户清分信息, 存在结算价则需要二次平台收入 * 计算商户清分信息, 存在结算价则需要二次平台收入
* @throws \App\Exception\custom\MerchantException
*/ */
private function make_merchant_clearing($merchant_cash, $platform) private function make_merchant_clearing($merchant_cash, $platform)
{ {
$m = $this->get_merchant_account($this->pay_order); $m = MerchantAccountService::get_merchant_account($this->pay_order);
$merchant['account_id'] = $m['account_id']; //商户 $merchant['account_id'] = $m['account_id']; //商户
$merchant['account_type'] = 2; //商户 $merchant['account_type'] = 2; //商户
...@@ -1125,7 +1125,7 @@ class PayService ...@@ -1125,7 +1125,7 @@ class PayService
throw new CodeSpecialException("failed" . __METHOD__); throw new CodeSpecialException("failed" . __METHOD__);
} }
*/ */
$url = "http://account.dev.yidian-inc.com/account/account/get_account"; $url = 'http://account.dev.yidian-inc.com' . "/account/account/get_account";
$ret = Sdk::call($url, [ $ret = Sdk::call($url, [
'life_account_id'=>$params['life_account_id'], 'life_account_id'=>$params['life_account_id'],
'shop_id'=>$params['shop_id'], 'shop_id'=>$params['shop_id'],
......
...@@ -28,7 +28,7 @@ class PlatformAccountService ...@@ -28,7 +28,7 @@ class PlatformAccountService
$cnt = true; $cnt = true;
$cnt = $cnt && PlatformAccount::update([ $cnt = $cnt && PlatformAccount::update([
'receivable_amount[+]'=>$data['amount'] 'receivable_amount[+]'=>$data['amount']
], ['platform_funds_id'=>$info['platform_funds_id']]); ], ['platform_account_id'=>$info['platform_account_id']]);
$cnt = $cnt && PlatformAccountLog::insert([ $cnt = $cnt && PlatformAccountLog::insert([
'platform_account_id'=>$info['platform_account_id'], 'platform_account_id'=>$info['platform_account_id'],
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
namespace App\Services\wallet; namespace App\Services\wallet;
use App\Exception\custom\CodeSpecialException; use App\Exception\custom\CodeSpecialException;
use App\Exception\custom\MerchantException;
use Helpers\Sdk; use Helpers\Sdk;
...@@ -17,14 +18,13 @@ class MerchantAccountService ...@@ -17,14 +18,13 @@ class MerchantAccountService
* 钱包记录同步 * 钱包记录同步
*/ */
public static function sync($params) { public static function sync($params) {
/*
///account/billrecord/create $url = config('interface', 'account.billrecord.create');
$url = config('interface', 'account.account.transfer');
if (!$url) { if (!$url) {
throw new CodeSpecialException("failed"); throw new MerchantException(['cus'=>1]);
} }
*/
$url = 'http://account.dev.yidian-inc.com/account/billrecord/create'; //$url = 'http://account.dev.yidian-inc.com/account/billrecord/create';
// 服务增加签名 // 服务增加签名
$appid = \Yaf\Application::app()->getConfig()->get('wallet.appid'); $appid = \Yaf\Application::app()->getConfig()->get('wallet.appid');
...@@ -37,9 +37,29 @@ class MerchantAccountService ...@@ -37,9 +37,29 @@ class MerchantAccountService
return Sdk::call($url, $params); return Sdk::call($url, $params);
} }
private function sign($params, $secret) { private static function sign($params, $secret) {
$sign = md5($params['time'] . $secret); $sign = md5($params['time'] . $secret);
return $sign; return $sign;
} }
public static function get_merchant_account($params)
{
$url = config('interface', 'account.account.get_account');
if (!$url) {
throw new MerchantException(['cus'=>1]);
}
$ret = Sdk::call($url, [
'life_account_id'=>$params['life_account_id'],
'shop_id'=>$params['shop_id'],
'source_name'=>$params['source_name'],
'service_name'=>$params['service_name'],
]);
if(empty($ret['result'])) {
throw new MerchantException(['cus'=>2]);
}
return $ret['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