1.控制抢购开关
This commit is contained in:
parent
fa365ebb90
commit
b2702d77ab
@ -43,7 +43,7 @@ class GroupBuyLogic extends Logic
|
||||
$item['goods_image'] = UrlServer::getFileUrl($item['goods_image']);
|
||||
|
||||
}
|
||||
|
||||
$lists = [];
|
||||
return [
|
||||
'count' => $count,
|
||||
'lists' => $lists,
|
||||
|
||||
@ -20,8 +20,11 @@ namespace app\index\controller;
|
||||
|
||||
|
||||
|
||||
use app\api\logic\BillionsLogic;
|
||||
use app\common\basics\IndexBase;
|
||||
use app\common\server\ConfigServer;
|
||||
use app\common\server\WeChatPayServer;
|
||||
use app\common\server\WeChatServer;
|
||||
use think\Exception;
|
||||
use think\facade\Db;
|
||||
class Index extends IndexBase
|
||||
{
|
||||
@ -72,4 +75,61 @@ class Index extends IndexBase
|
||||
// Db::name("local_return")->save($data);
|
||||
// }
|
||||
}
|
||||
|
||||
public function billions(){
|
||||
$result = Db::name("user_billions_surplus")
|
||||
->where("residue_price",">","0")
|
||||
->where("user_start_price",">","0")
|
||||
->find();
|
||||
if($result != null){
|
||||
$r = Db::name("user_billions")->alias("a")
|
||||
->join("user_billions_surplus_log b","a.billions_id = b.billions_id","left")
|
||||
->where("a.billions_id","<=",$result['billions_id'])
|
||||
->where("b.surplus_id IS NULL")
|
||||
->limit(1000)
|
||||
->select()->toArray();
|
||||
foreach($r as $key=>$value){
|
||||
|
||||
$ranking = BillionsLogic::getRanking($value['billions_id']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function retund(){
|
||||
$config = WeChatServer::getPayConfigBySource(1)['config'];
|
||||
if (empty($config)) {
|
||||
throw new Exception('请联系管理员设置微信相关配置!');
|
||||
}
|
||||
if (!isset($config['cert_path']) || !isset($config['key_path'])) {
|
||||
throw new Exception('请联系管理员设置微信证书!');
|
||||
}
|
||||
if (!file_exists($config['cert_path']) || !file_exists($config['key_path'])) {
|
||||
throw new Exception('微信证书不存在,请联系管理员!');
|
||||
}
|
||||
|
||||
$result = WeChatPayServer::refund($config, [
|
||||
'transaction_id' => "4200002417202409298999399108",
|
||||
'refund_sn' => "202409291431067057",
|
||||
'total_fee' => intval(strval(650 * 100)),//订单金额,单位为分
|
||||
'refund_fee' => intval(strval(650 * 100)),//退款金额
|
||||
]);
|
||||
var_dump($result);
|
||||
if (isset($result['return_code']) && $result['return_code'] == 'FAIL') {
|
||||
throw new Exception($result['return_msg']);
|
||||
}
|
||||
if (isset($result['err_code_des'])) {
|
||||
throw new Exception($result['err_code_des']);
|
||||
}
|
||||
if ($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS') {
|
||||
//更新退款日志记录
|
||||
$dat['wechat_refund_id'] = $result['refund_id'] ?? 0;
|
||||
$dat['refund_msg'] = json_encode($result, JSON_UNESCAPED_UNICODE);
|
||||
$dat['dtime'] = date("Y-m-d H:i:s");
|
||||
Db::name("local_pay_return")->save($dat);
|
||||
} else {
|
||||
throw new Exception('微信支付退款失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user