mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-10-03 15:39:57 +08:00
代码微调
This commit is contained in:
parent
5f121221cf
commit
436c24e429
@ -85,10 +85,12 @@ class UserAdminService extends Service
|
|||||||
*/
|
*/
|
||||||
public function get(int $uuid, ?string $type = null): array
|
public function get(int $uuid, ?string $type = null): array
|
||||||
{
|
{
|
||||||
$user = $this->app->db->name('DataUser')->where(['id' => $uuid, 'deleted' => 0])->findOrEmpty();
|
$map = ['id' => $uuid, 'deleted' => 0];
|
||||||
|
$user = $this->app->db->name('DataUser')->where($map)->find();
|
||||||
if (empty($user)) throw new Exception('指定UID用户不存在');
|
if (empty($user)) throw new Exception('指定UID用户不存在');
|
||||||
if (!is_null($type)) {
|
if (!is_null($type)) {
|
||||||
$data = $this->app->db->name('DataUserToken')->where(['uid' => $uuid, 'type' => $type])->findOrEmpty();
|
$map = ['uid' => $uuid, 'type' => $type];
|
||||||
|
$data = $this->app->db->name('DataUserToken')->where($map)->find();
|
||||||
if (empty($data)) {
|
if (empty($data)) {
|
||||||
[$state, $info, $data] = UserTokenService::instance()->token($uuid, $type);
|
[$state, $info, $data] = UserTokenService::instance()->token($uuid, $type);
|
||||||
if (empty($state) || empty($data)) throw new Exception($info);
|
if (empty($state) || empty($data)) throw new Exception($info);
|
||||||
|
@ -61,6 +61,7 @@ class BalancePyamentService extends PaymentService
|
|||||||
try {
|
try {
|
||||||
// 扣减用户余额
|
// 扣减用户余额
|
||||||
$this->app->db->transaction(function () use ($order, $paymentAmount) {
|
$this->app->db->transaction(function () use ($order, $paymentAmount) {
|
||||||
|
// 更新订单余额
|
||||||
$this->app->db->name('ShopOrder')->where(['order_no' => $order['order_no']])->update([
|
$this->app->db->name('ShopOrder')->where(['order_no' => $order['order_no']])->update([
|
||||||
'payment_balance' => $paymentAmount,
|
'payment_balance' => $paymentAmount,
|
||||||
]);
|
]);
|
||||||
|
@ -60,6 +60,6 @@ class EmptyPaymentService extends PaymentService
|
|||||||
$this->createPaymentAction($orderNo, $paymentTitle, $paymentAmount);
|
$this->createPaymentAction($orderNo, $paymentTitle, $paymentAmount);
|
||||||
// 更新支付行为
|
// 更新支付行为
|
||||||
$this->updatePaymentAction($orderNo, CodeExtend::uniqidDate(20), $paymentAmount, '无需支付');
|
$this->updatePaymentAction($orderNo, CodeExtend::uniqidDate(20), $paymentAmount, '无需支付');
|
||||||
return ['code' => 1, 'info' => '无需支付'];
|
return ['code' => 1, 'info' => '订单无需支付'];
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -102,7 +102,7 @@ class JoinpayPaymentService extends PaymentService
|
|||||||
* @param array $data
|
* @param array $data
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function _doReuest($data = []): array
|
private function _doReuest(array $data = []): array
|
||||||
{
|
{
|
||||||
$data['hmac'] = $this->_doSign($data);
|
$data['hmac'] = $this->_doSign($data);
|
||||||
return json_decode(HttpExtend::post($this->uri, $data), true);
|
return json_decode(HttpExtend::post($this->uri, $data), true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user