...
|
...
|
@@ -11,6 +11,7 @@ use think\Hook; |
|
|
use EasyWeChat\Factory;
|
|
|
use think\Db;
|
|
|
use app\common\model\Attachment;
|
|
|
use think\process\exception\Timeout;
|
|
|
|
|
|
/**
|
|
|
* 公共接口
|
...
|
...
|
@@ -430,7 +431,7 @@ class Common extends Api |
|
|
];
|
|
|
$app = Factory::officialAccount($config);
|
|
|
try {
|
|
|
$result = $app->refund->byTransactionId($PayOrderInfo['WeChatOrder'], $PayOrderInfo['PayOrder'], $PayOrderInfo['money'] * 100, $TuiMoney*100); // 总金额 100, 退款 80,操作员:商户号
|
|
|
$result = $app->refund->byTransactionId($PayOrderInfo['WeChatOrder'], $PayOrderInfo['PayOrder'], $PayOrderInfo['money'] * 100, $TuiMoney * 100); // 总金额 100, 退款 80,操作员:商户号
|
|
|
//更改订单状态为已退款
|
|
|
Db::name('pay_order')->where('OrderSn', $OrderSn)->where('PayOrder', $PayOrderInfo['PayOrder'])->update(['type' => 0]);
|
|
|
} catch (Exception $e) {
|
...
|
...
|
@@ -513,7 +514,7 @@ class Common extends Api |
|
|
];
|
|
|
$app = Factory::officialAccount($config);
|
|
|
try {
|
|
|
$result = $app->refund->byTransactionId($PayOrderInfo['WeChatOrder'], $PayOrderInfo['PayOrder'], $PayOrderInfo['money'] * 100, $TuiMoney*100); // 总金额 100, 退款 80,操作员:商户号
|
|
|
$result = $app->refund->byTransactionId($PayOrderInfo['WeChatOrder'], $PayOrderInfo['PayOrder'], $PayOrderInfo['money'] * 100, $TuiMoney * 100); // 总金额 100, 退款 80,操作员:商户号
|
|
|
//更改订单状态为已退款
|
|
|
Db::name('pay_order')->where('OrderSn', $OrderSn)->where('PayOrder', $PayOrderInfo['PayOrder'])->update(['type' => 0]);
|
|
|
} catch (Exception $e) {
|
...
|
...
|
@@ -661,4 +662,31 @@ class Common extends Api |
|
|
);
|
|
|
$this->res($res);
|
|
|
}
|
|
|
|
|
|
|
|
|
//定时任务
|
|
|
public function MonthMoney()
|
|
|
{
|
|
|
$Arr = Db::name('agreement')->select();
|
|
|
if (!empty($Arr)) {
|
|
|
foreach ($Arr as $k => $v) {
|
|
|
if (time() > $v['EXP_time']) {
|
|
|
if ($v['Money'] > $v['MonthMoney']) {
|
|
|
//扣钱+时间
|
|
|
$res = Db::name('agreement')->where('id', $v['id'])->update(['Money' => $v['Money'] - $v['MonthMoney'], 'EXP_time' => $v['EXP_time'] + 86400 * 30]);
|
|
|
if (!$res) {
|
|
|
$this->error('失败id' . $v['id'], 0);
|
|
|
die;
|
|
|
}
|
|
|
} else {
|
|
|
$res = Db::name('agreement')->where('id', $v['id'])->update(['status' => 3]);
|
|
|
if (!$res) {
|
|
|
$this->error('失败id' . $v['id'], 0);
|
|
|
die;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} |
...
|
...
|
|