优化页面和模型
This commit is contained in:
@@ -5,9 +5,9 @@ declare(strict_types=1);
|
|||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
use app\common\controller\Backend;
|
use app\common\controller\Backend;
|
||||||
use app\common\model\MallPlayxClaimLog;
|
use app\common\model\MallClaimLog;
|
||||||
use app\common\model\MallPlayxOrder;
|
use app\common\model\MallOrder;
|
||||||
use app\common\model\MallPlayxUserAsset;
|
use app\common\model\MallUserAsset;
|
||||||
use support\think\Db;
|
use support\think\Db;
|
||||||
use Webman\Http\Request;
|
use Webman\Http\Request;
|
||||||
use support\Response;
|
use support\Response;
|
||||||
@@ -23,28 +23,28 @@ class Dashboard extends Backend
|
|||||||
$todayStart = strtotime(date('Y-m-d', $now) . ' 00:00:00');
|
$todayStart = strtotime(date('Y-m-d', $now) . ' 00:00:00');
|
||||||
$yesterdayStart = $todayStart - 86400;
|
$yesterdayStart = $todayStart - 86400;
|
||||||
|
|
||||||
$newPlayersToday = MallPlayxUserAsset::where('create_time', '>=', $todayStart)
|
$newPlayersToday = MallUserAsset::where('create_time', '>=', $todayStart)
|
||||||
->where('create_time', '<=', $now)
|
->where('create_time', '<=', $now)
|
||||||
->count();
|
->count();
|
||||||
|
|
||||||
$yesterdayPointsClaimed = MallPlayxClaimLog::where('create_time', '>=', $yesterdayStart)
|
$yesterdayPointsClaimed = MallClaimLog::where('create_time', '>=', $yesterdayStart)
|
||||||
->where('create_time', '<', $todayStart)
|
->where('create_time', '<', $todayStart)
|
||||||
->sum('claimed_amount');
|
->sum('claimed_amount');
|
||||||
|
|
||||||
$yesterdayRedeemQuery = MallPlayxOrder::where('create_time', '>=', $yesterdayStart)
|
$yesterdayRedeemQuery = MallOrder::where('create_time', '>=', $yesterdayStart)
|
||||||
->where('create_time', '<', $todayStart);
|
->where('create_time', '<', $todayStart);
|
||||||
|
|
||||||
$yesterdayRedeemCount = (clone $yesterdayRedeemQuery)->count();
|
$yesterdayRedeemCount = (clone $yesterdayRedeemQuery)->count();
|
||||||
$yesterdayRedeemPointsCostSum = (clone $yesterdayRedeemQuery)->sum('points_cost');
|
$yesterdayRedeemPointsCostSum = (clone $yesterdayRedeemQuery)->sum('points_cost');
|
||||||
$yesterdayRedeemAmountSum = (clone $yesterdayRedeemQuery)->sum('amount');
|
$yesterdayRedeemAmountSum = (clone $yesterdayRedeemQuery)->sum('amount');
|
||||||
$yesterdayRedeemCompletedCount = (clone $yesterdayRedeemQuery)
|
$yesterdayRedeemCompletedCount = (clone $yesterdayRedeemQuery)
|
||||||
->where('status', MallPlayxOrder::STATUS_COMPLETED)
|
->where('status', MallOrder::STATUS_COMPLETED)
|
||||||
->count();
|
->count();
|
||||||
$yesterdayRedeemRejectedCount = (clone $yesterdayRedeemQuery)
|
$yesterdayRedeemRejectedCount = (clone $yesterdayRedeemQuery)
|
||||||
->where('status', MallPlayxOrder::STATUS_REJECTED)
|
->where('status', MallOrder::STATUS_REJECTED)
|
||||||
->count();
|
->count();
|
||||||
|
|
||||||
$yesterdayRedeemByItem = Db::name('mall_playx_order')
|
$yesterdayRedeemByItem = Db::name('mall_order')
|
||||||
->alias('o')
|
->alias('o')
|
||||||
->leftJoin('mall_item i', 'i.id = o.mall_item_id')
|
->leftJoin('mall_item i', 'i.id = o.mall_item_id')
|
||||||
->where('o.create_time', '>=', $yesterdayStart)
|
->where('o.create_time', '>=', $yesterdayStart)
|
||||||
@@ -63,11 +63,11 @@ class Dashboard extends Backend
|
|||||||
->select()
|
->select()
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
$pendingPhysicalToShip = MallPlayxOrder::where('type', MallPlayxOrder::TYPE_PHYSICAL)
|
$pendingPhysicalToShip = MallOrder::where('type', MallOrder::TYPE_PHYSICAL)
|
||||||
->where('status', MallPlayxOrder::STATUS_PENDING)
|
->where('status', MallOrder::STATUS_PENDING)
|
||||||
->count();
|
->count();
|
||||||
$grantFailedRetryableCount = MallPlayxOrder::whereIn('type', [MallPlayxOrder::TYPE_BONUS, MallPlayxOrder::TYPE_WITHDRAW])
|
$grantFailedRetryableCount = MallOrder::whereIn('type', [MallOrder::TYPE_BONUS, MallOrder::TYPE_WITHDRAW])
|
||||||
->where('grant_status', MallPlayxOrder::GRANT_FAILED_RETRYABLE)
|
->where('grant_status', MallOrder::GRANT_FAILED_RETRYABLE)
|
||||||
->count();
|
->count();
|
||||||
|
|
||||||
return $this->success('', [
|
return $this->success('', [
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ use support\Response;
|
|||||||
use Webman\Http\Request;
|
use Webman\Http\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlayX 领取记录(后台列表)
|
* 领取记录(后台列表)
|
||||||
*/
|
*/
|
||||||
class PlayxClaimLog extends Backend
|
class ClaimLog extends Backend
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var object|null
|
* @var object|null
|
||||||
* @phpstan-var \app\common\model\MallPlayxClaimLog|null
|
* @phpstan-var \app\common\model\MallClaimLog|null
|
||||||
*/
|
*/
|
||||||
protected ?object $model = null;
|
protected ?object $model = null;
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ class PlayxClaimLog extends Backend
|
|||||||
public function initialize(): void
|
public function initialize(): void
|
||||||
{
|
{
|
||||||
parent::initialize();
|
parent::initialize();
|
||||||
$this->model = new \app\common\model\MallPlayxClaimLog();
|
$this->model = new \app\common\model\MallClaimLog();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -8,13 +8,13 @@ use support\Response;
|
|||||||
use Webman\Http\Request;
|
use Webman\Http\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlayX 每日推送数据(后台列表)
|
* 每日推送数据(后台列表)
|
||||||
*/
|
*/
|
||||||
class PlayxDailyPush extends Backend
|
class DailyPush extends Backend
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var object|null
|
* @var object|null
|
||||||
* @phpstan-var \app\common\model\MallPlayxDailyPush|null
|
* @phpstan-var \app\common\model\MallDailyPush|null
|
||||||
*/
|
*/
|
||||||
protected ?object $model = null;
|
protected ?object $model = null;
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ class PlayxDailyPush extends Backend
|
|||||||
public function initialize(): void
|
public function initialize(): void
|
||||||
{
|
{
|
||||||
parent::initialize();
|
parent::initialize();
|
||||||
$this->model = new \app\common\model\MallPlayxDailyPush();
|
$this->model = new \app\common\model\MallDailyPush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4,20 +4,20 @@ namespace app\admin\controller\mall;
|
|||||||
|
|
||||||
use Throwable;
|
use Throwable;
|
||||||
use app\common\controller\Backend;
|
use app\common\controller\Backend;
|
||||||
use app\common\model\MallPlayxOrder;
|
use app\common\model\MallOrder;
|
||||||
use app\common\model\MallPlayxUserAsset;
|
use app\common\model\MallUserAsset;
|
||||||
use support\think\Db;
|
use support\think\Db;
|
||||||
use support\Response;
|
use support\Response;
|
||||||
use Webman\Http\Request;
|
use Webman\Http\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlayX 统一订单(后台列表)
|
* 统一订单(后台列表)
|
||||||
*/
|
*/
|
||||||
class PlayxOrder extends Backend
|
class Order extends Backend
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var object|null
|
* @var object|null
|
||||||
* @phpstan-var \app\common\model\MallPlayxOrder|null
|
* @phpstan-var \app\common\model\MallOrder|null
|
||||||
*/
|
*/
|
||||||
protected ?object $model = null;
|
protected ?object $model = null;
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ class PlayxOrder extends Backend
|
|||||||
public function initialize(): void
|
public function initialize(): void
|
||||||
{
|
{
|
||||||
parent::initialize();
|
parent::initialize();
|
||||||
$this->model = new \app\common\model\MallPlayxOrder();
|
$this->model = new \app\common\model\MallOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,7 +71,7 @@ class PlayxOrder extends Backend
|
|||||||
return $this->select($request);
|
return $this->select($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
list($where, $alias, $limit, $order) = $this->queryBuilder();
|
[$where, $alias, $limit, $order] = $this->queryBuilder();
|
||||||
$res = $this->model
|
$res = $this->model
|
||||||
->with(['mallItem' => function ($query) {
|
->with(['mallItem' => function ($query) {
|
||||||
$query->field('id,title');
|
$query->field('id,title');
|
||||||
@@ -104,22 +104,22 @@ class PlayxOrder extends Backend
|
|||||||
}
|
}
|
||||||
|
|
||||||
$data = $request->post();
|
$data = $request->post();
|
||||||
$id = intval($data['id'] ?? 0);
|
$id = $data['id'] ?? 0;
|
||||||
$shippingCompany = strval($data['shipping_company'] ?? '');
|
$shippingCompany = $data['shipping_company'] ?? '';
|
||||||
$shippingNo = strval($data['shipping_no'] ?? '');
|
$shippingNo = $data['shipping_no'] ?? '';
|
||||||
|
|
||||||
if ($id <= 0 || $shippingCompany === '' || $shippingNo === '') {
|
if (!$id || $shippingCompany === '' || $shippingNo === '') {
|
||||||
return $this->error(__('Missing required fields'));
|
return $this->error(__('Missing required fields'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$order = MallPlayxOrder::where('id', $id)->find();
|
$order = MallOrder::where('id', $id)->find();
|
||||||
if (!$order) {
|
if (!$order) {
|
||||||
return $this->error(__('Record not found'));
|
return $this->error(__('Record not found'));
|
||||||
}
|
}
|
||||||
if ($order->type !== MallPlayxOrder::TYPE_PHYSICAL) {
|
if ($order->type !== MallOrder::TYPE_PHYSICAL) {
|
||||||
return $this->error(__('Order type not PHYSICAL'));
|
return $this->error(__('Order type not PHYSICAL'));
|
||||||
}
|
}
|
||||||
if ($order->status !== MallPlayxOrder::STATUS_PENDING) {
|
if ($order->status !== MallOrder::STATUS_PENDING) {
|
||||||
return $this->error(__('Order status must be PENDING'));
|
return $this->error(__('Order status must be PENDING'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ class PlayxOrder extends Backend
|
|||||||
try {
|
try {
|
||||||
$order->shipping_company = $shippingCompany;
|
$order->shipping_company = $shippingCompany;
|
||||||
$order->shipping_no = $shippingNo;
|
$order->shipping_no = $shippingNo;
|
||||||
$order->status = MallPlayxOrder::STATUS_SHIPPED;
|
$order->status = MallOrder::STATUS_SHIPPED;
|
||||||
$order->save();
|
$order->save();
|
||||||
Db::commit();
|
Db::commit();
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
@@ -153,40 +153,40 @@ class PlayxOrder extends Backend
|
|||||||
}
|
}
|
||||||
|
|
||||||
$data = $request->post();
|
$data = $request->post();
|
||||||
$id = intval($data['id'] ?? 0);
|
$id = $data['id'] ?? 0;
|
||||||
$rejectReason = strval($data['reject_reason'] ?? '');
|
$rejectReason = $data['reject_reason'] ?? '';
|
||||||
|
|
||||||
if ($id <= 0 || $rejectReason === '') {
|
if (!$id || $rejectReason === '') {
|
||||||
return $this->error(__('Missing required fields'));
|
return $this->error(__('Missing required fields'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$order = MallPlayxOrder::where('id', $id)->find();
|
$order = MallOrder::where('id', $id)->find();
|
||||||
if (!$order) {
|
if (!$order) {
|
||||||
return $this->error(__('Record not found'));
|
return $this->error(__('Record not found'));
|
||||||
}
|
}
|
||||||
if ($order->type !== MallPlayxOrder::TYPE_PHYSICAL) {
|
if ($order->type !== MallOrder::TYPE_PHYSICAL) {
|
||||||
return $this->error(__('Order type not PHYSICAL'));
|
return $this->error(__('Order type not PHYSICAL'));
|
||||||
}
|
}
|
||||||
if ($order->status !== MallPlayxOrder::STATUS_PENDING) {
|
if ($order->status !== MallOrder::STATUS_PENDING) {
|
||||||
return $this->error(__('Order status must be PENDING'));
|
return $this->error(__('Order status must be PENDING'));
|
||||||
}
|
}
|
||||||
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
$asset = MallPlayxUserAsset::where('playx_user_id', strval($order->user_id ?? ''))->find();
|
$asset = MallUserAsset::where('playx_user_id', $order->user_id ?? '')->find();
|
||||||
if (!$asset) {
|
if (!$asset) {
|
||||||
throw new \RuntimeException('User asset not found');
|
throw new \RuntimeException('User asset not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$refund = intval($order->points_cost ?? 0);
|
$refund = $order->points_cost ?? 0;
|
||||||
if ($refund > 0) {
|
if ($refund > 0) {
|
||||||
$asset->available_points += $refund;
|
$asset->available_points += $refund;
|
||||||
$asset->save();
|
$asset->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
$order->status = MallPlayxOrder::STATUS_REJECTED;
|
$order->status = MallOrder::STATUS_REJECTED;
|
||||||
$order->reject_reason = $rejectReason;
|
$order->reject_reason = $rejectReason;
|
||||||
$order->grant_status = MallPlayxOrder::GRANT_FAILED_FINAL;
|
$order->grant_status = MallOrder::GRANT_FAILED_FINAL;
|
||||||
$order->save();
|
$order->save();
|
||||||
|
|
||||||
Db::commit();
|
Db::commit();
|
||||||
@@ -212,26 +212,26 @@ class PlayxOrder extends Backend
|
|||||||
return $this->error(__('Parameter error'));
|
return $this->error(__('Parameter error'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = intval($request->post('id', 0));
|
$id = $request->post('id', 0);
|
||||||
if ($id <= 0) {
|
if (!$id) {
|
||||||
return $this->error(__('Missing required fields'));
|
return $this->error(__('Missing required fields'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$order = MallPlayxOrder::where('id', $id)->find();
|
$order = MallOrder::where('id', $id)->find();
|
||||||
if (!$order) {
|
if (!$order) {
|
||||||
return $this->error(__('Record not found'));
|
return $this->error(__('Record not found'));
|
||||||
}
|
}
|
||||||
if (!in_array($order->type, [MallPlayxOrder::TYPE_BONUS, MallPlayxOrder::TYPE_WITHDRAW], true)) {
|
if (!in_array($order->type, [MallOrder::TYPE_BONUS, MallOrder::TYPE_WITHDRAW], true)) {
|
||||||
return $this->error(__('Only BONUS/WITHDRAW can retry'));
|
return $this->error(__('Only BONUS/WITHDRAW can retry'));
|
||||||
}
|
}
|
||||||
if ($order->grant_status !== MallPlayxOrder::GRANT_FAILED_RETRYABLE) {
|
if ($order->grant_status !== MallOrder::GRANT_FAILED_RETRYABLE) {
|
||||||
return $this->error(__('Only FAILED_RETRYABLE can retry'));
|
return $this->error(__('Only FAILED_RETRYABLE can retry'));
|
||||||
}
|
}
|
||||||
if (intval($order->retry_count) >= 3) {
|
if (($order->retry_count ?? 0) >= 3) {
|
||||||
return $this->error(__('Retry count exceeded'));
|
return $this->error(__('Retry count exceeded'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$order->grant_status = MallPlayxOrder::GRANT_NOT_SENT;
|
$order->grant_status = MallOrder::GRANT_NOT_SENT;
|
||||||
$order->save();
|
$order->save();
|
||||||
|
|
||||||
return $this->success(__('Retry queued'));
|
return $this->success(__('Retry queued'));
|
||||||
@@ -7,13 +7,13 @@ use support\Response;
|
|||||||
use Webman\Http\Request;
|
use Webman\Http\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlayX 用户资产(后台列表)
|
* 用户资产(后台列表)
|
||||||
*/
|
*/
|
||||||
class PlayxUserAsset extends Backend
|
class UserAsset extends Backend
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var object|null
|
* @var object|null
|
||||||
* @phpstan-var \app\common\model\MallPlayxUserAsset|null
|
* @phpstan-var \app\common\model\MallUserAsset|null
|
||||||
*/
|
*/
|
||||||
protected ?object $model = null;
|
protected ?object $model = null;
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ class PlayxUserAsset extends Backend
|
|||||||
public function initialize(): void
|
public function initialize(): void
|
||||||
{
|
{
|
||||||
parent::initialize();
|
parent::initialize();
|
||||||
$this->model = new \app\common\model\MallPlayxUserAsset();
|
$this->model = new \app\common\model\MallUserAsset();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,7 +55,7 @@ class PlayxUserAsset extends Backend
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
list($where, $alias, $limit, $order) = $this->queryBuilder();
|
[$where, $alias, $limit, $order] = $this->queryBuilder();
|
||||||
$res = $this->model
|
$res = $this->model
|
||||||
->field('id,username')
|
->field('id,username')
|
||||||
->alias($alias)
|
->alias($alias)
|
||||||
@@ -67,8 +67,8 @@ class PlayxUserAsset extends Backend
|
|||||||
foreach ($res->items() as $row) {
|
foreach ($res->items() as $row) {
|
||||||
$arr = $row->toArray();
|
$arr = $row->toArray();
|
||||||
$list[] = [
|
$list[] = [
|
||||||
'id' => intval($arr['id'] ?? 0),
|
'id' => $arr['id'] ?? 0,
|
||||||
'username' => strval($arr['username'] ?? ''),
|
'username' => $arr['username'] ?? '',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,3 +79,4 @@ class PlayxUserAsset extends Backend
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ use app\common\controller\Api;
|
|||||||
use app\common\facade\Token;
|
use app\common\facade\Token;
|
||||||
use app\common\library\Auth as UserAuth;
|
use app\common\library\Auth as UserAuth;
|
||||||
use app\common\library\AgentJwt;
|
use app\common\library\AgentJwt;
|
||||||
use app\common\model\MallPlayxUserAsset;
|
use app\common\model\MallUserAsset;
|
||||||
use app\admin\model\Admin;
|
use app\admin\model\Admin;
|
||||||
use Webman\Http\Request;
|
use Webman\Http\Request;
|
||||||
use support\Response;
|
use support\Response;
|
||||||
@@ -100,7 +100,7 @@ class Auth extends Api
|
|||||||
/**
|
/**
|
||||||
* H5 临时登录(GET/POST)
|
* H5 临时登录(GET/POST)
|
||||||
* 参数:username
|
* 参数:username
|
||||||
* 写入或复用 mall_playx_user_asset;签发 muser 类型 token(user_id 为资产表主键)
|
* 写入或复用 mall_user_asset;签发 muser 类型 token(user_id 为资产表主键)
|
||||||
*/
|
*/
|
||||||
public function temLogin(Request $request): Response
|
public function temLogin(Request $request): Response
|
||||||
{
|
{
|
||||||
@@ -120,7 +120,7 @@ class Auth extends Api
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$asset = MallPlayxUserAsset::ensureForUsername($username);
|
$asset = MallUserAsset::ensureForUsername($username);
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
return $this->error($e->getMessage());
|
return $this->error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ use app\common\controller\Api;
|
|||||||
use app\common\facade\Token;
|
use app\common\facade\Token;
|
||||||
use app\common\library\Auth as UserAuth;
|
use app\common\library\Auth as UserAuth;
|
||||||
use app\common\model\MallItem;
|
use app\common\model\MallItem;
|
||||||
use app\common\model\MallPlayxClaimLog;
|
use app\common\model\MallClaimLog;
|
||||||
use app\common\model\MallPlayxDailyPush;
|
use app\common\model\MallDailyPush;
|
||||||
use app\common\model\MallPlayxSession;
|
use app\common\model\MallSession;
|
||||||
use app\common\model\MallPlayxOrder;
|
use app\common\model\MallOrder;
|
||||||
use app\common\model\MallPlayxUserAsset;
|
use app\common\model\MallUserAsset;
|
||||||
use app\common\model\MallAddress;
|
use app\common\model\MallAddress;
|
||||||
use support\think\Db;
|
use support\think\Db;
|
||||||
use Webman\Http\Request;
|
use Webman\Http\Request;
|
||||||
@@ -25,17 +25,17 @@ use support\Response;
|
|||||||
class Playx extends Api
|
class Playx extends Api
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 从请求解析 mall_playx_user_asset.id(muser token、session、user_id 均指向资产表主键或 playx_user_id)
|
* 从请求解析 mall_user_asset.id(muser token、session、user_id 均指向资产表主键或 playx_user_id)
|
||||||
*/
|
*/
|
||||||
private function resolvePlayxAssetIdFromRequest(Request $request): ?int
|
private function resolvePlayxAssetIdFromRequest(Request $request): ?int
|
||||||
{
|
{
|
||||||
$sessionId = strval($request->post('session_id', $request->get('session_id', '')));
|
$sessionId = strval($request->post('session_id', $request->get('session_id', '')));
|
||||||
if ($sessionId !== '') {
|
if ($sessionId !== '') {
|
||||||
$session = MallPlayxSession::where('session_id', $sessionId)->find();
|
$session = MallSession::where('session_id', $sessionId)->find();
|
||||||
if ($session) {
|
if ($session) {
|
||||||
$expireTime = intval($session->expire_time ?? 0);
|
$expireTime = intval($session->expire_time ?? 0);
|
||||||
if ($expireTime > time()) {
|
if ($expireTime > time()) {
|
||||||
$asset = MallPlayxUserAsset::where('playx_user_id', strval($session->user_id ?? ''))->find();
|
$asset = MallUserAsset::where('playx_user_id', strval($session->user_id ?? ''))->find();
|
||||||
if ($asset) {
|
if ($asset) {
|
||||||
return intval($asset->getKey());
|
return intval($asset->getKey());
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ class Playx extends Api
|
|||||||
return intval($userId);
|
return intval($userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
$asset = MallPlayxUserAsset::where('playx_user_id', $userId)->find();
|
$asset = MallUserAsset::where('playx_user_id', $userId)->find();
|
||||||
if ($asset) {
|
if ($asset) {
|
||||||
return intval($asset->getKey());
|
return intval($asset->getKey());
|
||||||
}
|
}
|
||||||
@@ -91,7 +91,7 @@ class Playx extends Api
|
|||||||
{
|
{
|
||||||
for ($i = 0; $i < 8; $i++) {
|
for ($i = 0; $i < 8; $i++) {
|
||||||
$candidate = '13' . str_pad(strval(mt_rand(0, 999999999)), 9, '0', STR_PAD_LEFT);
|
$candidate = '13' . str_pad(strval(mt_rand(0, 999999999)), 9, '0', STR_PAD_LEFT);
|
||||||
if (!MallPlayxUserAsset::where('phone', $candidate)->find()) {
|
if (!MallUserAsset::where('phone', $candidate)->find()) {
|
||||||
return $candidate;
|
return $candidate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,9 +99,9 @@ class Playx extends Api
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function ensureAssetForPlayx(string $playxUserId, string $username): ?MallPlayxUserAsset
|
private function ensureAssetForPlayx(string $playxUserId, string $username): ?MallUserAsset
|
||||||
{
|
{
|
||||||
$asset = MallPlayxUserAsset::where('playx_user_id', $playxUserId)->find();
|
$asset = MallUserAsset::where('playx_user_id', $playxUserId)->find();
|
||||||
if ($asset) {
|
if ($asset) {
|
||||||
return $asset;
|
return $asset;
|
||||||
}
|
}
|
||||||
@@ -110,7 +110,7 @@ class Playx extends Api
|
|||||||
if ($effectiveUsername === '') {
|
if ($effectiveUsername === '') {
|
||||||
$effectiveUsername = 'playx_' . $playxUserId;
|
$effectiveUsername = 'playx_' . $playxUserId;
|
||||||
}
|
}
|
||||||
$byName = MallPlayxUserAsset::where('username', $effectiveUsername)->find();
|
$byName = MallUserAsset::where('username', $effectiveUsername)->find();
|
||||||
if ($byName) {
|
if ($byName) {
|
||||||
$byName->playx_user_id = $playxUserId;
|
$byName->playx_user_id = $playxUserId;
|
||||||
$byName->save();
|
$byName->save();
|
||||||
@@ -125,7 +125,7 @@ class Playx extends Api
|
|||||||
$pwd = hash_password(Random::build('alnum', 16));
|
$pwd = hash_password(Random::build('alnum', 16));
|
||||||
$now = time();
|
$now = time();
|
||||||
|
|
||||||
return MallPlayxUserAsset::create([
|
return MallUserAsset::create([
|
||||||
'playx_user_id' => $playxUserId,
|
'playx_user_id' => $playxUserId,
|
||||||
'username' => $effectiveUsername,
|
'username' => $effectiveUsername,
|
||||||
'phone' => $phone,
|
'phone' => $phone,
|
||||||
@@ -141,9 +141,9 @@ class Playx extends Api
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getAssetById(int $assetId): ?MallPlayxUserAsset
|
private function getAssetById(int $assetId): ?MallUserAsset
|
||||||
{
|
{
|
||||||
return MallPlayxUserAsset::where('id', $assetId)->find();
|
return MallUserAsset::where('id', $assetId)->find();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -219,7 +219,7 @@ class Playx extends Api
|
|||||||
$lifetimeTotalDeposit = $m['lty_deposit'] ?? 0;
|
$lifetimeTotalDeposit = $m['lty_deposit'] ?? 0;
|
||||||
$lifetimeTotalWithdraw = $m['lty_withdrawal'] ?? 0;
|
$lifetimeTotalWithdraw = $m['lty_withdrawal'] ?? 0;
|
||||||
|
|
||||||
$exists = MallPlayxDailyPush::where('user_id', $playxUserId)->where('date', $date)->find();
|
$exists = MallDailyPush::where('user_id', $playxUserId)->where('date', $date)->find();
|
||||||
if ($exists) {
|
if ($exists) {
|
||||||
$results[] = [
|
$results[] = [
|
||||||
'user_id' => $playxUserId,
|
'user_id' => $playxUserId,
|
||||||
@@ -232,7 +232,7 @@ class Playx extends Api
|
|||||||
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
MallPlayxDailyPush::create([
|
MallDailyPush::create([
|
||||||
'user_id' => $playxUserId,
|
'user_id' => $playxUserId,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'username' => $username,
|
'username' => $username,
|
||||||
@@ -304,7 +304,7 @@ class Playx extends Api
|
|||||||
return $this->error(__('Missing required fields: request_id, date, user_id'));
|
return $this->error(__('Missing required fields: request_id, date, user_id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$exists = MallPlayxDailyPush::where('user_id', $playxUserId)->where('date', $date)->find();
|
$exists = MallDailyPush::where('user_id', $playxUserId)->where('date', $date)->find();
|
||||||
if ($exists) {
|
if ($exists) {
|
||||||
return $this->success('', [
|
return $this->success('', [
|
||||||
'request_id' => $requestId,
|
'request_id' => $requestId,
|
||||||
@@ -316,7 +316,7 @@ class Playx extends Api
|
|||||||
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
MallPlayxDailyPush::create([
|
MallDailyPush::create([
|
||||||
'user_id' => $playxUserId,
|
'user_id' => $playxUserId,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'username' => $body['username'] ?? '',
|
'username' => $body['username'] ?? '',
|
||||||
@@ -427,7 +427,7 @@ class Playx extends Api
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sessionId = bin2hex(random_bytes(16));
|
$sessionId = bin2hex(random_bytes(16));
|
||||||
MallPlayxSession::create([
|
MallSession::create([
|
||||||
'session_id' => $sessionId,
|
'session_id' => $sessionId,
|
||||||
'user_id' => $userId,
|
'user_id' => $userId,
|
||||||
'username' => $username,
|
'username' => $username,
|
||||||
@@ -448,7 +448,7 @@ class Playx extends Api
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 本地校验 temLogin 等写入的商城 token(类型 muser),写入 mall_playx_session
|
* 本地校验 temLogin 等写入的商城 token(类型 muser),写入 mall_session
|
||||||
*/
|
*/
|
||||||
private function verifyTokenLocal(string $token): Response
|
private function verifyTokenLocal(string $token): Response
|
||||||
{
|
{
|
||||||
@@ -465,7 +465,7 @@ class Playx extends Api
|
|||||||
return $this->error(__('Invalid token'), null, 0, ['statusCode' => 401]);
|
return $this->error(__('Invalid token'), null, 0, ['statusCode' => 401]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$asset = MallPlayxUserAsset::where('id', $assetId)->find();
|
$asset = MallUserAsset::where('id', $assetId)->find();
|
||||||
if (!$asset) {
|
if (!$asset) {
|
||||||
return $this->error(__('Invalid token'), null, 0, ['statusCode' => 401]);
|
return $this->error(__('Invalid token'), null, 0, ['statusCode' => 401]);
|
||||||
}
|
}
|
||||||
@@ -477,7 +477,7 @@ class Playx extends Api
|
|||||||
|
|
||||||
$expireAt = time() + intval(config('playx.session_expire_seconds', 3600));
|
$expireAt = time() + intval(config('playx.session_expire_seconds', 3600));
|
||||||
$sessionId = bin2hex(random_bytes(16));
|
$sessionId = bin2hex(random_bytes(16));
|
||||||
MallPlayxSession::create([
|
MallSession::create([
|
||||||
'session_id' => $sessionId,
|
'session_id' => $sessionId,
|
||||||
'user_id' => $playxUserId,
|
'user_id' => $playxUserId,
|
||||||
'username' => strval($asset->username ?? ''),
|
'username' => strval($asset->username ?? ''),
|
||||||
@@ -556,7 +556,7 @@ class Playx extends Api
|
|||||||
}
|
}
|
||||||
$playxUserId = strval($asset->playx_user_id);
|
$playxUserId = strval($asset->playx_user_id);
|
||||||
|
|
||||||
$exists = MallPlayxClaimLog::where('claim_request_id', $claimRequestId)->find();
|
$exists = MallClaimLog::where('claim_request_id', $claimRequestId)->find();
|
||||||
if ($exists) {
|
if ($exists) {
|
||||||
return $this->success('', $this->formatAsset($asset));
|
return $this->success('', $this->formatAsset($asset));
|
||||||
}
|
}
|
||||||
@@ -576,7 +576,7 @@ class Playx extends Api
|
|||||||
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
MallPlayxClaimLog::create([
|
MallClaimLog::create([
|
||||||
'claim_request_id' => $claimRequestId,
|
'claim_request_id' => $claimRequestId,
|
||||||
'user_id' => $playxUserId,
|
'user_id' => $playxUserId,
|
||||||
'claimed_amount' => $canClaim,
|
'claimed_amount' => $canClaim,
|
||||||
@@ -667,7 +667,7 @@ class Playx extends Api
|
|||||||
return $this->success('', ['list' => []]);
|
return $this->success('', ['list' => []]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$list = MallPlayxOrder::where('user_id', strval($asset->playx_user_id))
|
$list = MallOrder::where('user_id', strval($asset->playx_user_id))
|
||||||
->with(['mallItem'])
|
->with(['mallItem'])
|
||||||
->order('id', 'desc')
|
->order('id', 'desc')
|
||||||
->limit(100)
|
->limit(100)
|
||||||
@@ -867,7 +867,7 @@ class Playx extends Api
|
|||||||
return $this->success('', ['deleted' => true]);
|
return $this->success('', ['deleted' => true]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function formatAsset(?MallPlayxUserAsset $asset): array
|
private function formatAsset(?MallUserAsset $asset): array
|
||||||
{
|
{
|
||||||
if (!$asset) {
|
if (!$asset) {
|
||||||
return [
|
return [
|
||||||
@@ -924,16 +924,16 @@ class Playx extends Api
|
|||||||
$asset->save();
|
$asset->save();
|
||||||
|
|
||||||
$orderNo = 'BONUS_ORD' . date('YmdHis') . mt_rand(1000, 9999);
|
$orderNo = 'BONUS_ORD' . date('YmdHis') . mt_rand(1000, 9999);
|
||||||
$order = MallPlayxOrder::create([
|
$order = MallOrder::create([
|
||||||
'user_id' => $playxUserId,
|
'user_id' => $playxUserId,
|
||||||
'type' => MallPlayxOrder::TYPE_BONUS,
|
'type' => MallOrder::TYPE_BONUS,
|
||||||
'status' => MallPlayxOrder::STATUS_PENDING,
|
'status' => MallOrder::STATUS_PENDING,
|
||||||
'mall_item_id' => $item->id,
|
'mall_item_id' => $item->id,
|
||||||
'points_cost' => $item->score,
|
'points_cost' => $item->score,
|
||||||
'amount' => $amount,
|
'amount' => $amount,
|
||||||
'multiplier' => $multiplier,
|
'multiplier' => $multiplier,
|
||||||
'external_transaction_id' => $orderNo,
|
'external_transaction_id' => $orderNo,
|
||||||
'grant_status' => MallPlayxOrder::GRANT_NOT_SENT,
|
'grant_status' => MallOrder::GRANT_NOT_SENT,
|
||||||
'create_time' => time(),
|
'create_time' => time(),
|
||||||
'update_time' => time(),
|
'update_time' => time(),
|
||||||
]);
|
]);
|
||||||
@@ -990,10 +990,10 @@ class Playx extends Api
|
|||||||
$asset->available_points -= $item->score;
|
$asset->available_points -= $item->score;
|
||||||
$asset->save();
|
$asset->save();
|
||||||
|
|
||||||
MallPlayxOrder::create([
|
MallOrder::create([
|
||||||
'user_id' => $playxUserId,
|
'user_id' => $playxUserId,
|
||||||
'type' => MallPlayxOrder::TYPE_PHYSICAL,
|
'type' => MallOrder::TYPE_PHYSICAL,
|
||||||
'status' => MallPlayxOrder::STATUS_PENDING,
|
'status' => MallOrder::STATUS_PENDING,
|
||||||
'mall_item_id' => $item->id,
|
'mall_item_id' => $item->id,
|
||||||
'points_cost' => $item->score,
|
'points_cost' => $item->score,
|
||||||
'receiver_name' => $receiverName,
|
'receiver_name' => $receiverName,
|
||||||
@@ -1053,16 +1053,16 @@ class Playx extends Api
|
|||||||
$asset->save();
|
$asset->save();
|
||||||
|
|
||||||
$orderNo = 'WITHDRAW_ORD' . date('YmdHis') . mt_rand(1000, 9999);
|
$orderNo = 'WITHDRAW_ORD' . date('YmdHis') . mt_rand(1000, 9999);
|
||||||
$order = MallPlayxOrder::create([
|
$order = MallOrder::create([
|
||||||
'user_id' => $playxUserId,
|
'user_id' => $playxUserId,
|
||||||
'type' => MallPlayxOrder::TYPE_WITHDRAW,
|
'type' => MallOrder::TYPE_WITHDRAW,
|
||||||
'status' => MallPlayxOrder::STATUS_PENDING,
|
'status' => MallOrder::STATUS_PENDING,
|
||||||
'mall_item_id' => $item->id,
|
'mall_item_id' => $item->id,
|
||||||
'points_cost' => $item->score,
|
'points_cost' => $item->score,
|
||||||
'amount' => $amount,
|
'amount' => $amount,
|
||||||
'multiplier' => $multiplier,
|
'multiplier' => $multiplier,
|
||||||
'external_transaction_id' => $orderNo,
|
'external_transaction_id' => $orderNo,
|
||||||
'grant_status' => MallPlayxOrder::GRANT_NOT_SENT,
|
'grant_status' => MallOrder::GRANT_NOT_SENT,
|
||||||
'create_time' => time(),
|
'create_time' => time(),
|
||||||
'update_time' => time(),
|
'update_time' => time(),
|
||||||
]);
|
]);
|
||||||
@@ -1084,7 +1084,7 @@ class Playx extends Api
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function callPlayxBonusGrant(MallPlayxOrder $order, MallItem $item, string $userId): void
|
private function callPlayxBonusGrant(MallOrder $order, MallItem $item, string $userId): void
|
||||||
{
|
{
|
||||||
$baseUrl = rtrim(config('playx.api.base_url', ''), '/');
|
$baseUrl = rtrim(config('playx.api.base_url', ''), '/');
|
||||||
$url = config('playx.api.bonus_grant_url', '/api/v1/bonus/grant');
|
$url = config('playx.api.bonus_grant_url', '/api/v1/bonus/grant');
|
||||||
@@ -1109,21 +1109,21 @@ class Playx extends Api
|
|||||||
$data = json_decode(strval($res->getBody()), true);
|
$data = json_decode(strval($res->getBody()), true);
|
||||||
if ($res->getStatusCode() === 200 && ($data['status'] ?? '') === 'accepted') {
|
if ($res->getStatusCode() === 200 && ($data['status'] ?? '') === 'accepted') {
|
||||||
$order->playx_transaction_id = $data['playx_transaction_id'] ?? '';
|
$order->playx_transaction_id = $data['playx_transaction_id'] ?? '';
|
||||||
$order->grant_status = MallPlayxOrder::GRANT_ACCEPTED;
|
$order->grant_status = MallOrder::GRANT_ACCEPTED;
|
||||||
$order->save();
|
$order->save();
|
||||||
} else {
|
} else {
|
||||||
$order->grant_status = MallPlayxOrder::GRANT_FAILED_RETRYABLE;
|
$order->grant_status = MallOrder::GRANT_FAILED_RETRYABLE;
|
||||||
$order->fail_reason = $data['message'] ?? 'unknown';
|
$order->fail_reason = $data['message'] ?? 'unknown';
|
||||||
$order->save();
|
$order->save();
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
$order->grant_status = MallPlayxOrder::GRANT_FAILED_RETRYABLE;
|
$order->grant_status = MallOrder::GRANT_FAILED_RETRYABLE;
|
||||||
$order->fail_reason = $e->getMessage();
|
$order->fail_reason = $e->getMessage();
|
||||||
$order->save();
|
$order->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function callPlayxBalanceCredit(MallPlayxOrder $order, string $userId): void
|
private function callPlayxBalanceCredit(MallOrder $order, string $userId): void
|
||||||
{
|
{
|
||||||
$baseUrl = rtrim(config('playx.api.base_url', ''), '/');
|
$baseUrl = rtrim(config('playx.api.base_url', ''), '/');
|
||||||
$url = config('playx.api.balance_credit_url', '/api/v1/balance/credit');
|
$url = config('playx.api.balance_credit_url', '/api/v1/balance/credit');
|
||||||
@@ -1145,15 +1145,15 @@ class Playx extends Api
|
|||||||
$data = json_decode(strval($res->getBody()), true);
|
$data = json_decode(strval($res->getBody()), true);
|
||||||
if ($res->getStatusCode() === 200 && ($data['status'] ?? '') === 'accepted') {
|
if ($res->getStatusCode() === 200 && ($data['status'] ?? '') === 'accepted') {
|
||||||
$order->playx_transaction_id = $data['playx_transaction_id'] ?? '';
|
$order->playx_transaction_id = $data['playx_transaction_id'] ?? '';
|
||||||
$order->grant_status = MallPlayxOrder::GRANT_ACCEPTED;
|
$order->grant_status = MallOrder::GRANT_ACCEPTED;
|
||||||
$order->save();
|
$order->save();
|
||||||
} else {
|
} else {
|
||||||
$order->grant_status = MallPlayxOrder::GRANT_FAILED_RETRYABLE;
|
$order->grant_status = MallOrder::GRANT_FAILED_RETRYABLE;
|
||||||
$order->fail_reason = $data['message'] ?? 'unknown';
|
$order->fail_reason = $data['message'] ?? 'unknown';
|
||||||
$order->save();
|
$order->save();
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
$order->grant_status = MallPlayxOrder::GRANT_FAILED_RETRYABLE;
|
$order->grant_status = MallOrder::GRANT_FAILED_RETRYABLE;
|
||||||
$order->fail_reason = $e->getMessage();
|
$order->fail_reason = $e->getMessage();
|
||||||
$order->save();
|
$order->save();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,6 @@ class MallAddress extends Model
|
|||||||
|
|
||||||
public function playxUserAsset(): \think\model\relation\BelongsTo
|
public function playxUserAsset(): \think\model\relation\BelongsTo
|
||||||
{
|
{
|
||||||
return $this->belongsTo(\app\common\model\MallPlayxUserAsset::class, 'playx_user_asset_id', 'id');
|
return $this->belongsTo(\app\common\model\MallUserAsset::class, 'playx_user_asset_id', 'id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,14 +7,15 @@ namespace app\common\model;
|
|||||||
use support\think\Model;
|
use support\think\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlayX 领取记录(幂等)
|
* 领取记录(幂等)
|
||||||
*/
|
*/
|
||||||
class MallPlayxClaimLog extends Model
|
class MallClaimLog extends Model
|
||||||
{
|
{
|
||||||
protected string $name = 'mall_playx_claim_log';
|
protected string $name = 'mall_claim_log';
|
||||||
|
|
||||||
protected array $type = [
|
protected array $type = [
|
||||||
'claimed_amount' => 'integer',
|
'claimed_amount' => 'integer',
|
||||||
'create_time' => 'integer',
|
'create_time' => 'integer',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7,11 +7,11 @@ namespace app\common\model;
|
|||||||
use support\think\Model;
|
use support\think\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlayX 每日推送数据
|
* 每日推送数据
|
||||||
*/
|
*/
|
||||||
class MallPlayxDailyPush extends Model
|
class MallDailyPush extends Model
|
||||||
{
|
{
|
||||||
protected string $name = 'mall_playx_daily_push';
|
protected string $name = 'mall_daily_push';
|
||||||
|
|
||||||
protected array $type = [
|
protected array $type = [
|
||||||
'yesterday_win_loss_net' => 'float',
|
'yesterday_win_loss_net' => 'float',
|
||||||
@@ -21,3 +21,4 @@ class MallPlayxDailyPush extends Model
|
|||||||
'create_time' => 'integer',
|
'create_time' => 'integer',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@ namespace app\common\model;
|
|||||||
use support\think\Model;
|
use support\think\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlayX 统一订单
|
* 统一订单
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property string $user_id
|
* @property string $user_id
|
||||||
@@ -29,9 +29,9 @@ use support\think\Model;
|
|||||||
* @property string $receiver_phone
|
* @property string $receiver_phone
|
||||||
* @property string|null $receiver_address
|
* @property string|null $receiver_address
|
||||||
*/
|
*/
|
||||||
class MallPlayxOrder extends Model
|
class MallOrder extends Model
|
||||||
{
|
{
|
||||||
protected string $name = 'mall_playx_order';
|
protected string $name = 'mall_order';
|
||||||
|
|
||||||
protected bool $autoWriteTimestamp = true;
|
protected bool $autoWriteTimestamp = true;
|
||||||
|
|
||||||
@@ -64,3 +64,4 @@ class MallPlayxOrder extends Model
|
|||||||
return $this->belongsTo(MallItem::class, 'mall_item_id', 'id');
|
return $this->belongsTo(MallItem::class, 'mall_item_id', 'id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,6 +21,6 @@ class MallPintsOrder extends Model
|
|||||||
|
|
||||||
public function playxUserAsset(): \think\model\relation\BelongsTo
|
public function playxUserAsset(): \think\model\relation\BelongsTo
|
||||||
{
|
{
|
||||||
return $this->belongsTo(\app\common\model\MallPlayxUserAsset::class, 'playx_user_asset_id', 'id');
|
return $this->belongsTo(\app\common\model\MallUserAsset::class, 'playx_user_asset_id', 'id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace app\common\model;
|
|
||||||
|
|
||||||
use support\think\Model;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PlayX 会话缓存
|
|
||||||
*/
|
|
||||||
class MallPlayxSession extends Model
|
|
||||||
{
|
|
||||||
protected string $name = 'mall_playx_session';
|
|
||||||
|
|
||||||
protected bool $autoWriteTimestamp = true;
|
|
||||||
|
|
||||||
protected array $type = [
|
|
||||||
// 这里需要显式声明 create_time / update_time 为 integer,
|
|
||||||
// 否则 ThinkORM 可能把 bigint 时间戳当成字符串,导致写入时出现 now 字符串问题。
|
|
||||||
'create_time' => 'integer',
|
|
||||||
'update_time' => 'integer',
|
|
||||||
'expire_time' => 'integer',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ class MallRedemptionOrder extends Model
|
|||||||
|
|
||||||
public function playxUserAsset(): \think\model\relation\BelongsTo
|
public function playxUserAsset(): \think\model\relation\BelongsTo
|
||||||
{
|
{
|
||||||
return $this->belongsTo(\app\common\model\MallPlayxUserAsset::class, 'playx_user_asset_id', 'id');
|
return $this->belongsTo(\app\common\model\MallUserAsset::class, 'playx_user_asset_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mallItem(): \think\model\relation\BelongsTo
|
public function mallItem(): \think\model\relation\BelongsTo
|
||||||
|
|||||||
24
app/common/model/MallSession.php
Normal file
24
app/common/model/MallSession.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace app\common\model;
|
||||||
|
|
||||||
|
use support\think\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会话缓存
|
||||||
|
*/
|
||||||
|
class MallSession extends Model
|
||||||
|
{
|
||||||
|
protected string $name = 'mall_session';
|
||||||
|
|
||||||
|
protected bool $autoWriteTimestamp = true;
|
||||||
|
|
||||||
|
protected array $type = [
|
||||||
|
'create_time' => 'integer',
|
||||||
|
'update_time' => 'integer',
|
||||||
|
'expire_time' => 'integer',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
@@ -8,11 +8,11 @@ use ba\Random;
|
|||||||
use support\think\Model;
|
use support\think\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlayX 用户资产(积分商城用户主表,含登录账号字段)
|
* 用户资产(积分商城用户主表,含登录账号字段)
|
||||||
*/
|
*/
|
||||||
class MallPlayxUserAsset extends Model
|
class MallUserAsset extends Model
|
||||||
{
|
{
|
||||||
protected string $name = 'mall_playx_user_asset';
|
protected string $name = 'mall_user_asset';
|
||||||
|
|
||||||
protected bool $autoWriteTimestamp = true;
|
protected bool $autoWriteTimestamp = true;
|
||||||
|
|
||||||
@@ -60,10 +60,10 @@ class MallPlayxUserAsset extends Model
|
|||||||
'update_time' => $now,
|
'update_time' => $now,
|
||||||
]);
|
]);
|
||||||
if (!$created) {
|
if (!$created) {
|
||||||
throw new \RuntimeException('Failed to create mall_playx_user_asset');
|
throw new \RuntimeException('Failed to create mall_user_asset');
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = intval($created->getKey());
|
$id = $created->getKey();
|
||||||
$finalPlayxId = 'mall_' . $id;
|
$finalPlayxId = 'mall_' . $id;
|
||||||
if (self::where('playx_user_id', $finalPlayxId)->where('id', '<>', $id)->find()) {
|
if (self::where('playx_user_id', $finalPlayxId)->where('id', '<>', $id)->find()) {
|
||||||
$finalPlayxId = 'mall_' . $id . '_' . bin2hex(random_bytes(4));
|
$finalPlayxId = 'mall_' . $id . '_' . bin2hex(random_bytes(4));
|
||||||
@@ -77,7 +77,7 @@ class MallPlayxUserAsset extends Model
|
|||||||
private static function allocateUniquePhone(): ?string
|
private static function allocateUniquePhone(): ?string
|
||||||
{
|
{
|
||||||
for ($i = 0; $i < 8; $i++) {
|
for ($i = 0; $i < 8; $i++) {
|
||||||
$candidate = '13' . str_pad(strval(mt_rand(0, 999999999)), 9, '0', STR_PAD_LEFT);
|
$candidate = '13' . str_pad(mt_rand(0, 999999999), 9, '0', STR_PAD_LEFT);
|
||||||
if (!self::where('phone', $candidate)->find()) {
|
if (!self::where('phone', $candidate)->find()) {
|
||||||
return $candidate;
|
return $candidate;
|
||||||
}
|
}
|
||||||
@@ -86,3 +86,4 @@ class MallPlayxUserAsset extends Model
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
namespace app\process;
|
namespace app\process;
|
||||||
|
|
||||||
use app\common\model\MallItem;
|
use app\common\model\MallItem;
|
||||||
use app\common\model\MallPlayxOrder;
|
use app\common\model\MallOrder;
|
||||||
use app\common\model\MallPlayxUserAsset;
|
use app\common\model\MallUserAsset;
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use Workerman\Timer;
|
use Workerman\Timer;
|
||||||
use Workerman\Worker;
|
use Workerman\Worker;
|
||||||
@@ -47,14 +47,14 @@ class PlayxJobs
|
|||||||
$path = strval(config('playx.api.transaction_status_url', '/api/v1/transaction/status'));
|
$path = strval(config('playx.api.transaction_status_url', '/api/v1/transaction/status'));
|
||||||
$url = rtrim($baseUrl, '/') . $path;
|
$url = rtrim($baseUrl, '/') . $path;
|
||||||
|
|
||||||
$list = MallPlayxOrder::where('grant_status', MallPlayxOrder::GRANT_ACCEPTED)
|
$list = MallOrder::where('grant_status', MallOrder::GRANT_ACCEPTED)
|
||||||
->where('status', MallPlayxOrder::STATUS_PENDING)
|
->where('status', MallOrder::STATUS_PENDING)
|
||||||
->order('id', 'desc')
|
->order('id', 'desc')
|
||||||
->limit(50)
|
->limit(50)
|
||||||
->select();
|
->select();
|
||||||
|
|
||||||
foreach ($list as $order) {
|
foreach ($list as $order) {
|
||||||
/** @var MallPlayxOrder $order */
|
/** @var MallOrder $order */
|
||||||
try {
|
try {
|
||||||
$res = $this->http->get($url, [
|
$res = $this->http->get($url, [
|
||||||
'query' => [
|
'query' => [
|
||||||
@@ -65,16 +65,16 @@ class PlayxJobs
|
|||||||
$data = json_decode(strval($res->getBody()), true) ?? [];
|
$data = json_decode(strval($res->getBody()), true) ?? [];
|
||||||
$pxStatus = $data['status'] ?? '';
|
$pxStatus = $data['status'] ?? '';
|
||||||
|
|
||||||
if ($pxStatus === MallPlayxOrder::STATUS_COMPLETED) {
|
if ($pxStatus === MallOrder::STATUS_COMPLETED) {
|
||||||
$order->status = MallPlayxOrder::STATUS_COMPLETED;
|
$order->status = MallOrder::STATUS_COMPLETED;
|
||||||
$order->save();
|
$order->save();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($pxStatus === 'FAILED' || $pxStatus === MallPlayxOrder::STATUS_REJECTED) {
|
if ($pxStatus === 'FAILED' || $pxStatus === MallOrder::STATUS_REJECTED) {
|
||||||
// 仅在从 PENDING 转 REJECTED 时退分,避免重复入账
|
// 仅在从 PENDING 转 REJECTED 时退分,避免重复入账
|
||||||
$order->status = MallPlayxOrder::STATUS_REJECTED;
|
$order->status = MallOrder::STATUS_REJECTED;
|
||||||
$order->grant_status = MallPlayxOrder::GRANT_FAILED_FINAL;
|
$order->grant_status = MallOrder::GRANT_FAILED_FINAL;
|
||||||
$order->fail_reason = strval($data['message'] ?? 'PlayX transaction failed');
|
$order->fail_reason = strval($data['message'] ?? 'PlayX transaction failed');
|
||||||
$order->save();
|
$order->save();
|
||||||
$this->refundPoints($order);
|
$this->refundPoints($order);
|
||||||
@@ -104,18 +104,18 @@ class PlayxJobs
|
|||||||
$withdrawUrl = rtrim($baseUrl, '/') . $withdrawPath;
|
$withdrawUrl = rtrim($baseUrl, '/') . $withdrawPath;
|
||||||
|
|
||||||
$maxRetry = 3;
|
$maxRetry = 3;
|
||||||
$list = MallPlayxOrder::whereIn('grant_status', [
|
$list = MallOrder::whereIn('grant_status', [
|
||||||
MallPlayxOrder::GRANT_NOT_SENT,
|
MallOrder::GRANT_NOT_SENT,
|
||||||
MallPlayxOrder::GRANT_FAILED_RETRYABLE,
|
MallOrder::GRANT_FAILED_RETRYABLE,
|
||||||
])
|
])
|
||||||
->where('status', MallPlayxOrder::STATUS_PENDING)
|
->where('status', MallOrder::STATUS_PENDING)
|
||||||
->where('retry_count', '<', $maxRetry)
|
->where('retry_count', '<', $maxRetry)
|
||||||
->order('id', 'desc')
|
->order('id', 'desc')
|
||||||
->limit(50)
|
->limit(50)
|
||||||
->select();
|
->select();
|
||||||
|
|
||||||
foreach ($list as $order) {
|
foreach ($list as $order) {
|
||||||
/** @var MallPlayxOrder $order */
|
/** @var MallOrder $order */
|
||||||
$allow = $this->allowRetryByInterval($order);
|
$allow = $this->allowRetryByInterval($order);
|
||||||
if (!$allow) {
|
if (!$allow) {
|
||||||
continue;
|
continue;
|
||||||
@@ -128,21 +128,21 @@ class PlayxJobs
|
|||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
$order->fail_reason = $e->getMessage();
|
$order->fail_reason = $e->getMessage();
|
||||||
if (intval($order->retry_count) >= $maxRetry) {
|
if (intval($order->retry_count) >= $maxRetry) {
|
||||||
$order->grant_status = MallPlayxOrder::GRANT_FAILED_FINAL;
|
$order->grant_status = MallOrder::GRANT_FAILED_FINAL;
|
||||||
$order->status = MallPlayxOrder::STATUS_REJECTED;
|
$order->status = MallOrder::STATUS_REJECTED;
|
||||||
$order->save();
|
$order->save();
|
||||||
$this->refundPoints($order);
|
$this->refundPoints($order);
|
||||||
} else {
|
} else {
|
||||||
$order->grant_status = MallPlayxOrder::GRANT_FAILED_RETRYABLE;
|
$order->grant_status = MallOrder::GRANT_FAILED_RETRYABLE;
|
||||||
$order->save();
|
$order->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function allowRetryByInterval(MallPlayxOrder $order): bool
|
private function allowRetryByInterval(MallOrder $order): bool
|
||||||
{
|
{
|
||||||
if ($order->grant_status === MallPlayxOrder::GRANT_NOT_SENT) {
|
if ($order->grant_status === MallOrder::GRANT_NOT_SENT) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ class PlayxJobs
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function sendGrantByOrder(MallPlayxOrder $order, string $bonusUrl, string $withdrawUrl, int $maxRetry): void
|
private function sendGrantByOrder(MallOrder $order, string $bonusUrl, string $withdrawUrl, int $maxRetry): void
|
||||||
{
|
{
|
||||||
$item = null;
|
$item = null;
|
||||||
if ($order->mallItem) {
|
if ($order->mallItem) {
|
||||||
@@ -176,7 +176,7 @@ class PlayxJobs
|
|||||||
$item = MallItem::where('id', $order->mall_item_id)->find();
|
$item = MallItem::where('id', $order->mall_item_id)->find();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($order->type === MallPlayxOrder::TYPE_BONUS) {
|
if ($order->type === MallOrder::TYPE_BONUS) {
|
||||||
$rewardName = $item ? strval($item->title) : '';
|
$rewardName = $item ? strval($item->title) : '';
|
||||||
$category = $item ? strval($item->category) : 'daily';
|
$category = $item ? strval($item->category) : 'daily';
|
||||||
$categoryTitle = $item ? strval($item->category_title) : '';
|
$categoryTitle = $item ? strval($item->category_title) : '';
|
||||||
@@ -201,7 +201,7 @@ class PlayxJobs
|
|||||||
|
|
||||||
$data = json_decode(strval($res->getBody()), true) ?? [];
|
$data = json_decode(strval($res->getBody()), true) ?? [];
|
||||||
if ($res->getStatusCode() === 200 && ($data['status'] ?? '') === 'accepted') {
|
if ($res->getStatusCode() === 200 && ($data['status'] ?? '') === 'accepted') {
|
||||||
$order->grant_status = MallPlayxOrder::GRANT_ACCEPTED;
|
$order->grant_status = MallOrder::GRANT_ACCEPTED;
|
||||||
$order->playx_transaction_id = strval($data['playx_transaction_id'] ?? '');
|
$order->playx_transaction_id = strval($data['playx_transaction_id'] ?? '');
|
||||||
$order->save();
|
$order->save();
|
||||||
return;
|
return;
|
||||||
@@ -209,19 +209,19 @@ class PlayxJobs
|
|||||||
|
|
||||||
$order->fail_reason = strval($data['message'] ?? 'PlayX bonus grant not accepted');
|
$order->fail_reason = strval($data['message'] ?? 'PlayX bonus grant not accepted');
|
||||||
if (intval($order->retry_count) >= $maxRetry) {
|
if (intval($order->retry_count) >= $maxRetry) {
|
||||||
$order->grant_status = MallPlayxOrder::GRANT_FAILED_FINAL;
|
$order->grant_status = MallOrder::GRANT_FAILED_FINAL;
|
||||||
$order->status = MallPlayxOrder::STATUS_REJECTED;
|
$order->status = MallOrder::STATUS_REJECTED;
|
||||||
$order->save();
|
$order->save();
|
||||||
$this->refundPoints($order);
|
$this->refundPoints($order);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$order->grant_status = MallPlayxOrder::GRANT_FAILED_RETRYABLE;
|
$order->grant_status = MallOrder::GRANT_FAILED_RETRYABLE;
|
||||||
$order->save();
|
$order->save();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($order->type === MallPlayxOrder::TYPE_WITHDRAW) {
|
if ($order->type === MallOrder::TYPE_WITHDRAW) {
|
||||||
$multiplier = intval($order->multiplier ?? 0);
|
$multiplier = intval($order->multiplier ?? 0);
|
||||||
if ($multiplier <= 0) {
|
if ($multiplier <= 0) {
|
||||||
$multiplier = 1;
|
$multiplier = 1;
|
||||||
@@ -239,7 +239,7 @@ class PlayxJobs
|
|||||||
|
|
||||||
$data = json_decode(strval($res->getBody()), true) ?? [];
|
$data = json_decode(strval($res->getBody()), true) ?? [];
|
||||||
if ($res->getStatusCode() === 200 && ($data['status'] ?? '') === 'accepted') {
|
if ($res->getStatusCode() === 200 && ($data['status'] ?? '') === 'accepted') {
|
||||||
$order->grant_status = MallPlayxOrder::GRANT_ACCEPTED;
|
$order->grant_status = MallOrder::GRANT_ACCEPTED;
|
||||||
$order->playx_transaction_id = strval($data['playx_transaction_id'] ?? '');
|
$order->playx_transaction_id = strval($data['playx_transaction_id'] ?? '');
|
||||||
$order->save();
|
$order->save();
|
||||||
return;
|
return;
|
||||||
@@ -247,14 +247,14 @@ class PlayxJobs
|
|||||||
|
|
||||||
$order->fail_reason = strval($data['message'] ?? 'PlayX balance credit not accepted');
|
$order->fail_reason = strval($data['message'] ?? 'PlayX balance credit not accepted');
|
||||||
if (intval($order->retry_count) >= $maxRetry) {
|
if (intval($order->retry_count) >= $maxRetry) {
|
||||||
$order->grant_status = MallPlayxOrder::GRANT_FAILED_FINAL;
|
$order->grant_status = MallOrder::GRANT_FAILED_FINAL;
|
||||||
$order->status = MallPlayxOrder::STATUS_REJECTED;
|
$order->status = MallOrder::STATUS_REJECTED;
|
||||||
$order->save();
|
$order->save();
|
||||||
$this->refundPoints($order);
|
$this->refundPoints($order);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$order->grant_status = MallPlayxOrder::GRANT_FAILED_RETRYABLE;
|
$order->grant_status = MallOrder::GRANT_FAILED_RETRYABLE;
|
||||||
$order->save();
|
$order->save();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -262,12 +262,12 @@ class PlayxJobs
|
|||||||
// PHYSICAL 目前由后台手工发货/驳回,不参与 PlayX 发放重试
|
// PHYSICAL 目前由后台手工发货/驳回,不参与 PlayX 发放重试
|
||||||
}
|
}
|
||||||
|
|
||||||
private function refundPoints(MallPlayxOrder $order): void
|
private function refundPoints(MallOrder $order): void
|
||||||
{
|
{
|
||||||
if ($order->points_cost <= 0) {
|
if ($order->points_cost <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$asset = MallPlayxUserAsset::where('playx_user_id', $order->user_id)->find();
|
$asset = MallUserAsset::where('playx_user_id', $order->user_id)->find();
|
||||||
if (!$asset) {
|
if (!$asset) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
26
tmp_sig.php
Normal file
26
tmp_sig.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$secret = '5590a339502b133f4d0c545c3cdad159a4827dfccb3f51bb110c56f9b96568ca';
|
||||||
|
$ts = '1700000123';
|
||||||
|
$rid = 'req_1700000000_234567';
|
||||||
|
$body = [
|
||||||
|
'report_date' => '1700000123',
|
||||||
|
'member' => [
|
||||||
|
[
|
||||||
|
'member_id' => '234567',
|
||||||
|
'login' => 'zhenhui',
|
||||||
|
'ltv_deposit' => 1500,
|
||||||
|
'ltv_withdrawal' => 1800,
|
||||||
|
'yesterday_total_wl' => -300,
|
||||||
|
'yesterday_total_deposit' => 600,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$json = json_encode($body);
|
||||||
|
$canonical = $ts . "\n" . $rid . "\nPOST\n/api/v1/playx/daily-push\n" . hash('sha256', $json);
|
||||||
|
|
||||||
|
echo "json={$json}\n";
|
||||||
|
echo "sha256=" . hash('sha256', $json) . "\n";
|
||||||
|
echo "X-Signature=" . hash_hmac('sha256', $canonical, $secret) . "\n";
|
||||||
|
|
||||||
9
web/src/lang/backend/en/mall/claimLog.ts
Normal file
9
web/src/lang/backend/en/mall/claimLog.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
export default {
|
||||||
|
id: 'id',
|
||||||
|
claim_request_id: 'claim_request_id',
|
||||||
|
user_id: 'user_id',
|
||||||
|
claimed_amount: 'claimed_amount',
|
||||||
|
create_time: 'create_time',
|
||||||
|
'quick Search Fields': 'id',
|
||||||
|
}
|
||||||
|
|
||||||
13
web/src/lang/backend/en/mall/dailyPush.ts
Normal file
13
web/src/lang/backend/en/mall/dailyPush.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
export default {
|
||||||
|
id: 'id',
|
||||||
|
user_id: 'user_id',
|
||||||
|
date: 'date',
|
||||||
|
username: 'username',
|
||||||
|
yesterday_win_loss_net: 'yesterday_win_loss_net',
|
||||||
|
yesterday_total_deposit: 'yesterday_total_deposit',
|
||||||
|
lifetime_total_deposit: 'lifetime_total_deposit',
|
||||||
|
lifetime_total_withdraw: 'lifetime_total_withdraw',
|
||||||
|
create_time: 'create_time',
|
||||||
|
'quick Search Fields': 'id',
|
||||||
|
}
|
||||||
|
|
||||||
37
web/src/lang/backend/en/mall/order.ts
Normal file
37
web/src/lang/backend/en/mall/order.ts
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
export default {
|
||||||
|
id: 'id',
|
||||||
|
user_id: 'user_id',
|
||||||
|
type: 'type',
|
||||||
|
'type BONUS': 'Bonus(BONUS)',
|
||||||
|
'type PHYSICAL': 'Physical(PHYSICAL)',
|
||||||
|
'type WITHDRAW': 'Withdraw(WITHDRAW)',
|
||||||
|
status: 'status',
|
||||||
|
'status PENDING': 'Pending(PENDING)',
|
||||||
|
'status COMPLETED': 'Completed(COMPLETED)',
|
||||||
|
'status SHIPPED': 'Shipped(SHIPPED)',
|
||||||
|
'status REJECTED': 'Rejected(REJECTED)',
|
||||||
|
mall_item_id: 'mall_item_id',
|
||||||
|
mallitem__title: 'title',
|
||||||
|
points_cost: 'points_cost',
|
||||||
|
amount: 'amount',
|
||||||
|
multiplier: 'multiplier',
|
||||||
|
external_transaction_id: 'external_transaction_id',
|
||||||
|
playx_transaction_id: 'playx_transaction_id',
|
||||||
|
grant_status: 'grant_status',
|
||||||
|
'grant_status NOT_SENT': 'NOT_SENT',
|
||||||
|
'grant_status SENT_PENDING': 'SENT_PENDING',
|
||||||
|
'grant_status ACCEPTED': 'ACCEPTED',
|
||||||
|
'grant_status FAILED_RETRYABLE': 'FAILED_RETRYABLE',
|
||||||
|
'grant_status FAILED_FINAL': 'FAILED_FINAL',
|
||||||
|
fail_reason: 'fail_reason',
|
||||||
|
reject_reason: 'reject_reason',
|
||||||
|
shipping_company: 'shipping_company',
|
||||||
|
shipping_no: 'shipping_no',
|
||||||
|
receiver_name: 'receiver_name',
|
||||||
|
receiver_phone: 'receiver_phone',
|
||||||
|
receiver_address: 'receiver_address',
|
||||||
|
create_time: 'create_time',
|
||||||
|
update_time: 'update_time',
|
||||||
|
'quick Search Fields': 'ID',
|
||||||
|
}
|
||||||
|
|
||||||
15
web/src/lang/backend/en/mall/userAsset.ts
Normal file
15
web/src/lang/backend/en/mall/userAsset.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
export default {
|
||||||
|
id: 'id',
|
||||||
|
username: 'username',
|
||||||
|
phone: 'phone',
|
||||||
|
playx_user_id: 'playx_user_id',
|
||||||
|
locked_points: 'locked_points',
|
||||||
|
available_points: 'available_points',
|
||||||
|
today_limit: 'today_limit',
|
||||||
|
today_claimed: 'today_claimed',
|
||||||
|
today_limit_date: 'today_limit_date',
|
||||||
|
create_time: 'create_time',
|
||||||
|
update_time: 'update_time',
|
||||||
|
'quick Search Fields': 'id, playx_user_id, username, phone',
|
||||||
|
}
|
||||||
|
|
||||||
9
web/src/lang/backend/zh-cn/mall/claimLog.ts
Normal file
9
web/src/lang/backend/zh-cn/mall/claimLog.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
export default {
|
||||||
|
id: 'ID',
|
||||||
|
claim_request_id: '领取幂等键',
|
||||||
|
user_id: '用户ID',
|
||||||
|
claimed_amount: '领取积分',
|
||||||
|
create_time: '创建时间',
|
||||||
|
'quick Search Fields': 'ID',
|
||||||
|
}
|
||||||
|
|
||||||
13
web/src/lang/backend/zh-cn/mall/dailyPush.ts
Normal file
13
web/src/lang/backend/zh-cn/mall/dailyPush.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
export default {
|
||||||
|
id: 'ID',
|
||||||
|
user_id: '用户ID',
|
||||||
|
date: '业务日期',
|
||||||
|
username: '用户名',
|
||||||
|
yesterday_win_loss_net: '昨日净输赢',
|
||||||
|
yesterday_total_deposit: '昨日总充值',
|
||||||
|
lifetime_total_deposit: '历史总充值',
|
||||||
|
lifetime_total_withdraw: '历史总提现',
|
||||||
|
create_time: '创建时间',
|
||||||
|
'quick Search Fields': 'ID',
|
||||||
|
}
|
||||||
|
|
||||||
37
web/src/lang/backend/zh-cn/mall/order.ts
Normal file
37
web/src/lang/backend/zh-cn/mall/order.ts
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
export default {
|
||||||
|
id: 'ID',
|
||||||
|
user_id: '用户ID',
|
||||||
|
type: '类型',
|
||||||
|
'type BONUS': '红利(BONUS)',
|
||||||
|
'type PHYSICAL': '实物(PHYSICAL)',
|
||||||
|
'type WITHDRAW': '提现(WITHDRAW)',
|
||||||
|
status: '状态',
|
||||||
|
'status PENDING': '处理中(PENDING)',
|
||||||
|
'status COMPLETED': '已完成(COMPLETED)',
|
||||||
|
'status SHIPPED': '已发货(SHIPPED)',
|
||||||
|
'status REJECTED': '已驳回(REJECTED)',
|
||||||
|
mall_item_id: '商品ID',
|
||||||
|
mallitem__title: '商品标题',
|
||||||
|
points_cost: '消耗积分',
|
||||||
|
amount: '现金面值',
|
||||||
|
multiplier: '流水倍数',
|
||||||
|
external_transaction_id: '外部交易幂等键',
|
||||||
|
playx_transaction_id: 'PlayX流水号',
|
||||||
|
grant_status: '发放子状态',
|
||||||
|
'grant_status NOT_SENT': '未发送',
|
||||||
|
'grant_status SENT_PENDING': '已发送排队',
|
||||||
|
'grant_status ACCEPTED': '已接收(accepted)',
|
||||||
|
'grant_status FAILED_RETRYABLE': '失败可重试',
|
||||||
|
'grant_status FAILED_FINAL': '失败最终',
|
||||||
|
fail_reason: '失败原因',
|
||||||
|
reject_reason: '驳回原因',
|
||||||
|
shipping_company: '物流公司',
|
||||||
|
shipping_no: '物流单号',
|
||||||
|
receiver_name: '收货人',
|
||||||
|
receiver_phone: '收货电话',
|
||||||
|
receiver_address: '收货地址',
|
||||||
|
create_time: '创建时间',
|
||||||
|
update_time: '修改时间',
|
||||||
|
'quick Search Fields': 'ID',
|
||||||
|
}
|
||||||
|
|
||||||
15
web/src/lang/backend/zh-cn/mall/userAsset.ts
Normal file
15
web/src/lang/backend/zh-cn/mall/userAsset.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
export default {
|
||||||
|
id: 'ID',
|
||||||
|
username: '用户名',
|
||||||
|
phone: '手机号',
|
||||||
|
playx_user_id: 'PlayX用户ID',
|
||||||
|
locked_points: '待领取积分',
|
||||||
|
available_points: '可用积分',
|
||||||
|
today_limit: '今日可领取上限',
|
||||||
|
today_claimed: '今日已领取',
|
||||||
|
today_limit_date: '今日上限日期',
|
||||||
|
create_time: '创建时间',
|
||||||
|
update_time: '修改时间',
|
||||||
|
'quick Search Fields': 'ID、PlayX用户ID、用户名、手机号',
|
||||||
|
}
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
type="remoteSelect"
|
type="remoteSelect"
|
||||||
v-model="baTable.form.items!.playx_user_asset_id"
|
v-model="baTable.form.items!.playx_user_asset_id"
|
||||||
prop="playx_user_asset_id"
|
prop="playx_user_asset_id"
|
||||||
:input-attr="{ pk: 'mall_playx_user_asset.id', field: 'username', remoteUrl: '/admin/mall.PlayxUserAsset/select' }"
|
:input-attr="{ pk: 'mall_user_asset.id', field: 'username', remoteUrl: '/admin/mall.UserAsset/select' }"
|
||||||
:placeholder="t('Please select field', { field: t('mall.address.playx_user_asset_id') })"
|
:placeholder="t('Please select field', { field: t('mall.address.playx_user_asset_id') })"
|
||||||
/>
|
/>
|
||||||
<FormItem
|
<FormItem
|
||||||
|
|||||||
61
web/src/views/backend/mall/claimLog/index.vue
Normal file
61
web/src/views/backend/mall/claimLog/index.vue
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
<template>
|
||||||
|
<div class="default-main ba-table-box">
|
||||||
|
<el-alert class="ba-table-alert" v-if="baTable.table.remark" :title="baTable.table.remark" type="info" show-icon />
|
||||||
|
|
||||||
|
<TableHeader
|
||||||
|
:buttons="['refresh', 'comSearch', 'quickSearch', 'columnDisplay']"
|
||||||
|
:quick-search-placeholder="t('Quick search placeholder', { fields: t('mall.claimLog.quick Search Fields') })"
|
||||||
|
></TableHeader>
|
||||||
|
|
||||||
|
<Table ref="tableRef"></Table>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted, provide, useTemplateRef } from 'vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { baTableApi } from '/@/api/common'
|
||||||
|
import TableHeader from '/@/components/table/header/index.vue'
|
||||||
|
import Table from '/@/components/table/index.vue'
|
||||||
|
import baTableClass from '/@/utils/baTable'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'mall/claimLog',
|
||||||
|
})
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
const tableRef = useTemplateRef('tableRef')
|
||||||
|
|
||||||
|
const baTable = new baTableClass(
|
||||||
|
new baTableApi('/admin/mall.ClaimLog/'),
|
||||||
|
{
|
||||||
|
pk: 'id',
|
||||||
|
column: [
|
||||||
|
{ type: 'selection', align: 'center', operator: false },
|
||||||
|
{ label: t('mall.claimLog.id'), prop: 'id', align: 'center', width: 70, operator: 'RANGE', sortable: 'custom' },
|
||||||
|
{ label: t('mall.claimLog.claim_request_id'), prop: 'claim_request_id', align: 'center', operatorPlaceholder: t('Fuzzy query'), sortable: false, operator: 'LIKE' },
|
||||||
|
{ label: t('mall.claimLog.user_id'), prop: 'user_id', align: 'center', operatorPlaceholder: t('Fuzzy query'), sortable: false, operator: 'LIKE' },
|
||||||
|
{ label: t('mall.claimLog.claimed_amount'), prop: 'claimed_amount', align: 'center', operator: 'RANGE', sortable: false },
|
||||||
|
{ label: t('mall.claimLog.create_time'), prop: 'create_time', align: 'center', render: 'datetime', operator: 'RANGE', comSearchRender: 'datetime', sortable: 'custom', width: 160, timeFormat: 'yyyy-mm-dd hh:MM:ss' },
|
||||||
|
],
|
||||||
|
dblClickNotEditColumn: [undefined],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
defaultItems: {},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
provide('baTable', baTable)
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
baTable.table.ref = tableRef.value
|
||||||
|
baTable.mount()
|
||||||
|
baTable.getData()?.then(() => {
|
||||||
|
baTable.initSort()
|
||||||
|
baTable.dragSort()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
||||||
|
|
||||||
65
web/src/views/backend/mall/dailyPush/index.vue
Normal file
65
web/src/views/backend/mall/dailyPush/index.vue
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
<template>
|
||||||
|
<div class="default-main ba-table-box">
|
||||||
|
<el-alert class="ba-table-alert" v-if="baTable.table.remark" :title="baTable.table.remark" type="info" show-icon />
|
||||||
|
|
||||||
|
<TableHeader
|
||||||
|
:buttons="['refresh', 'comSearch', 'quickSearch', 'columnDisplay']"
|
||||||
|
:quick-search-placeholder="t('Quick search placeholder', { fields: t('mall.dailyPush.quick Search Fields') })"
|
||||||
|
></TableHeader>
|
||||||
|
|
||||||
|
<Table ref="tableRef"></Table>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted, provide, useTemplateRef } from 'vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { baTableApi } from '/@/api/common'
|
||||||
|
import TableHeader from '/@/components/table/header/index.vue'
|
||||||
|
import Table from '/@/components/table/index.vue'
|
||||||
|
import baTableClass from '/@/utils/baTable'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'mall/dailyPush',
|
||||||
|
})
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
const tableRef = useTemplateRef('tableRef')
|
||||||
|
|
||||||
|
const baTable = new baTableClass(
|
||||||
|
new baTableApi('/admin/mall.DailyPush/'),
|
||||||
|
{
|
||||||
|
pk: 'id',
|
||||||
|
column: [
|
||||||
|
{ type: 'selection', align: 'center', operator: false },
|
||||||
|
{ label: t('mall.dailyPush.id'), prop: 'id', align: 'center', width: 70, operator: 'RANGE', sortable: 'custom' },
|
||||||
|
{ label: t('mall.dailyPush.user_id'), prop: 'user_id', align: 'center', operatorPlaceholder: t('Fuzzy query'), sortable: false, operator: 'LIKE' },
|
||||||
|
{ label: t('mall.dailyPush.date'), prop: 'date', align: 'center', render: 'date', operator: 'RANGE', comSearchRender: 'date', sortable: 'custom', width: 120, operatorPlaceholder: t('Fuzzy query') },
|
||||||
|
{ label: t('mall.dailyPush.username'), prop: 'username', align: 'center', operatorPlaceholder: t('Fuzzy query'), sortable: false, operator: 'LIKE' },
|
||||||
|
{ label: t('mall.dailyPush.yesterday_win_loss_net'), prop: 'yesterday_win_loss_net', align: 'center', operator: 'RANGE', sortable: false },
|
||||||
|
{ label: t('mall.dailyPush.yesterday_total_deposit'), prop: 'yesterday_total_deposit', align: 'center', operator: 'RANGE', sortable: false },
|
||||||
|
{ label: t('mall.dailyPush.lifetime_total_deposit'), prop: 'lifetime_total_deposit', align: 'center', operator: 'RANGE', sortable: false },
|
||||||
|
{ label: t('mall.dailyPush.lifetime_total_withdraw'), prop: 'lifetime_total_withdraw', align: 'center', operator: 'RANGE', sortable: false },
|
||||||
|
{ label: t('mall.dailyPush.create_time'), prop: 'create_time', align: 'center', render: 'datetime', operator: 'RANGE', comSearchRender: 'datetime', sortable: 'custom', width: 160, timeFormat: 'yyyy-mm-dd hh:MM:ss' },
|
||||||
|
],
|
||||||
|
dblClickNotEditColumn: [undefined],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
defaultItems: {},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
provide('baTable', baTable)
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
baTable.table.ref = tableRef.value
|
||||||
|
baTable.mount()
|
||||||
|
baTable.getData()?.then(() => {
|
||||||
|
baTable.initSort()
|
||||||
|
baTable.dragSort()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
||||||
|
|
||||||
232
web/src/views/backend/mall/order/index.vue
Normal file
232
web/src/views/backend/mall/order/index.vue
Normal file
@@ -0,0 +1,232 @@
|
|||||||
|
<template>
|
||||||
|
<div class="default-main ba-table-box">
|
||||||
|
<el-alert class="ba-table-alert" v-if="baTable.table.remark" :title="baTable.table.remark" type="info" show-icon />
|
||||||
|
|
||||||
|
<TableHeader
|
||||||
|
:buttons="['refresh', 'comSearch', 'quickSearch', 'columnDisplay']"
|
||||||
|
:quick-search-placeholder="t('Quick search placeholder', { fields: t('mall.order.quick Search Fields') })"
|
||||||
|
></TableHeader>
|
||||||
|
|
||||||
|
<Table ref="tableRef"></Table>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted, provide, useTemplateRef } from 'vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { baTableApi } from '/@/api/common'
|
||||||
|
import createAxios from '/@/utils/axios'
|
||||||
|
import TableHeader from '/@/components/table/header/index.vue'
|
||||||
|
import Table from '/@/components/table/index.vue'
|
||||||
|
import baTableClass from '/@/utils/baTable'
|
||||||
|
import { ElMessageBox } from 'element-plus'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'mall/order',
|
||||||
|
})
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
const tableRef = useTemplateRef('tableRef')
|
||||||
|
|
||||||
|
const baTable = new baTableClass(
|
||||||
|
new baTableApi('/admin/mall.Order/'),
|
||||||
|
{
|
||||||
|
pk: 'id',
|
||||||
|
column: [
|
||||||
|
{ type: 'selection', align: 'center', operator: false },
|
||||||
|
{ label: t('mall.order.id'), prop: 'id', align: 'center', width: 70, operator: 'RANGE', sortable: 'custom' },
|
||||||
|
{ label: t('mall.order.user_id'), prop: 'user_id', align: 'center', operatorPlaceholder: t('Fuzzy query'), sortable: false, operator: 'LIKE' },
|
||||||
|
{
|
||||||
|
label: t('mall.order.type'),
|
||||||
|
prop: 'type',
|
||||||
|
align: 'center',
|
||||||
|
operator: 'eq',
|
||||||
|
sortable: false,
|
||||||
|
render: 'tag',
|
||||||
|
replaceValue: {
|
||||||
|
BONUS: t('mall.order.type BONUS'),
|
||||||
|
PHYSICAL: t('mall.order.type PHYSICAL'),
|
||||||
|
WITHDRAW: t('mall.order.type WITHDRAW'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: t('mall.order.status'),
|
||||||
|
prop: 'status',
|
||||||
|
align: 'center',
|
||||||
|
operator: 'eq',
|
||||||
|
sortable: false,
|
||||||
|
render: 'tag',
|
||||||
|
replaceValue: {
|
||||||
|
PENDING: t('mall.order.status PENDING'),
|
||||||
|
COMPLETED: t('mall.order.status COMPLETED'),
|
||||||
|
SHIPPED: t('mall.order.status SHIPPED'),
|
||||||
|
REJECTED: t('mall.order.status REJECTED'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ label: t('mall.order.mall_item_id'), prop: 'mall_item_id', align: 'center', operator: 'RANGE', sortable: false },
|
||||||
|
{ label: t('mall.order.mallitem__title'), prop: 'mallItem.title', align: 'center', operatorPlaceholder: t('Fuzzy query'), sortable: false, operator: 'LIKE' },
|
||||||
|
{ label: t('mall.order.points_cost'), prop: 'points_cost', align: 'center', operator: 'RANGE', sortable: false },
|
||||||
|
{ label: t('mall.order.amount'), prop: 'amount', align: 'center', operator: 'RANGE', sortable: false },
|
||||||
|
{ label: t('mall.order.multiplier'), prop: 'multiplier', align: 'center', operator: 'eq', sortable: false },
|
||||||
|
{ label: t('mall.order.external_transaction_id'), prop: 'external_transaction_id', align: 'center', operatorPlaceholder: t('Fuzzy query'), sortable: false, operator: 'LIKE' },
|
||||||
|
{ label: t('mall.order.playx_transaction_id'), prop: 'playx_transaction_id', align: 'center', operatorPlaceholder: t('Fuzzy query'), sortable: false, operator: 'LIKE' },
|
||||||
|
{
|
||||||
|
label: t('mall.order.grant_status'),
|
||||||
|
prop: 'grant_status',
|
||||||
|
align: 'center',
|
||||||
|
operator: 'eq',
|
||||||
|
sortable: false,
|
||||||
|
render: 'tag',
|
||||||
|
replaceValue: {
|
||||||
|
NOT_SENT: t('mall.order.grant_status NOT_SENT'),
|
||||||
|
SENT_PENDING: t('mall.order.grant_status SENT_PENDING'),
|
||||||
|
ACCEPTED: t('mall.order.grant_status ACCEPTED'),
|
||||||
|
FAILED_RETRYABLE: t('mall.order.grant_status FAILED_RETRYABLE'),
|
||||||
|
FAILED_FINAL: t('mall.order.grant_status FAILED_FINAL'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ label: t('mall.order.fail_reason'), prop: 'fail_reason', align: 'center', showOverflowTooltip: true, operatorPlaceholder: t('Fuzzy query'), sortable: false, operator: 'LIKE' },
|
||||||
|
{ label: t('mall.order.reject_reason'), prop: 'reject_reason', align: 'center', showOverflowTooltip: true, sortable: false, operator: 'LIKE', operatorPlaceholder: t('Fuzzy query') },
|
||||||
|
{ label: t('mall.order.shipping_company'), prop: 'shipping_company', align: 'center', showOverflowTooltip: true, sortable: false, operator: 'LIKE', operatorPlaceholder: t('Fuzzy query') },
|
||||||
|
{ label: t('mall.order.shipping_no'), prop: 'shipping_no', align: 'center', showOverflowTooltip: true, sortable: false, operator: 'LIKE', operatorPlaceholder: t('Fuzzy query') },
|
||||||
|
{ label: t('mall.order.receiver_name'), prop: 'receiver_name', align: 'center', showOverflowTooltip: true, sortable: false, operator: 'LIKE', operatorPlaceholder: t('Fuzzy query') },
|
||||||
|
{ label: t('mall.order.receiver_phone'), prop: 'receiver_phone', align: 'center', showOverflowTooltip: true, sortable: false, operator: 'LIKE', operatorPlaceholder: t('Fuzzy query') },
|
||||||
|
{ label: t('mall.order.receiver_address'), prop: 'receiver_address', align: 'center', showOverflowTooltip: true, sortable: false, operator: 'LIKE', operatorPlaceholder: t('Fuzzy query') },
|
||||||
|
{ label: t('mall.order.create_time'), prop: 'create_time', align: 'center', render: 'datetime', operator: 'RANGE', comSearchRender: 'datetime', sortable: 'custom', width: 160, timeFormat: 'yyyy-mm-dd hh:MM:ss' },
|
||||||
|
{ label: t('mall.order.update_time'), prop: 'update_time', align: 'center', render: 'datetime', operator: 'RANGE', comSearchRender: 'datetime', sortable: 'custom', width: 160, timeFormat: 'yyyy-mm-dd hh:MM:ss' },
|
||||||
|
{
|
||||||
|
label: t('Operate'),
|
||||||
|
align: 'center',
|
||||||
|
width: 220,
|
||||||
|
render: 'buttons',
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
render: 'confirmButton',
|
||||||
|
name: 'retry',
|
||||||
|
title: 'Retry',
|
||||||
|
text: '手动重试',
|
||||||
|
type: 'warning',
|
||||||
|
icon: '',
|
||||||
|
display: (row: TableRow) =>
|
||||||
|
(row.type === 'BONUS' || row.type === 'WITHDRAW') && row.grant_status === 'FAILED_RETRYABLE' && row.status === 'PENDING',
|
||||||
|
popconfirm: {
|
||||||
|
title: '确认将该订单加入重试队列?',
|
||||||
|
confirmButtonText: '确认',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
confirmButtonType: 'warning',
|
||||||
|
},
|
||||||
|
click: async (row: TableRow) => {
|
||||||
|
await createAxios(
|
||||||
|
{
|
||||||
|
url: '/admin/mall.Order/retry',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
id: row.id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
showSuccessMessage: true,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
await baTable.getData()
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
render: 'basicButton',
|
||||||
|
name: 'ship',
|
||||||
|
title: 'Ship',
|
||||||
|
text: '发货',
|
||||||
|
type: 'success',
|
||||||
|
icon: '',
|
||||||
|
display: (row: TableRow) => row.type === 'PHYSICAL' && row.status === 'PENDING',
|
||||||
|
click: async (row: TableRow) => {
|
||||||
|
try {
|
||||||
|
const shippingNoRes = await ElMessageBox.prompt('请输入物流单号', '发货', {
|
||||||
|
confirmButtonText: '确认',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
})
|
||||||
|
const shippingCompanyRes = await ElMessageBox.prompt('请输入物流公司', '发货', {
|
||||||
|
confirmButtonText: '确认',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
})
|
||||||
|
|
||||||
|
const shippingNo = shippingNoRes.value
|
||||||
|
const shippingCompany = shippingCompanyRes.value
|
||||||
|
|
||||||
|
await createAxios(
|
||||||
|
{
|
||||||
|
url: '/admin/mall.Order/ship',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
id: row.id,
|
||||||
|
shipping_company: shippingCompany,
|
||||||
|
shipping_no: shippingNo,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
showSuccessMessage: true,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
await baTable.getData()
|
||||||
|
} catch {
|
||||||
|
// 用户取消弹窗:不做任何提示,避免控制台报错
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
render: 'basicButton',
|
||||||
|
name: 'reject',
|
||||||
|
title: 'Reject',
|
||||||
|
text: '驳回',
|
||||||
|
type: 'danger',
|
||||||
|
icon: '',
|
||||||
|
display: (row: TableRow) => row.type === 'PHYSICAL' && row.status === 'PENDING',
|
||||||
|
click: async (row: TableRow) => {
|
||||||
|
try {
|
||||||
|
const res = await ElMessageBox.prompt('请输入驳回原因', '驳回', {
|
||||||
|
confirmButtonText: '确认',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
})
|
||||||
|
await createAxios(
|
||||||
|
{
|
||||||
|
url: '/admin/mall.Order/reject',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
id: row.id,
|
||||||
|
reject_reason: res.value,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
showSuccessMessage: true,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
await baTable.getData()
|
||||||
|
} catch {
|
||||||
|
// 用户取消:不提示
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
dblClickNotEditColumn: [undefined],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
defaultItems: {},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
provide('baTable', baTable)
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
baTable.table.ref = tableRef.value
|
||||||
|
baTable.mount()
|
||||||
|
baTable.getData()?.then(() => {
|
||||||
|
baTable.initSort()
|
||||||
|
baTable.dragSort()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
type="remoteSelect"
|
type="remoteSelect"
|
||||||
v-model="baTable.form.items!.playx_user_asset_id"
|
v-model="baTable.form.items!.playx_user_asset_id"
|
||||||
prop="playx_user_asset_id"
|
prop="playx_user_asset_id"
|
||||||
:input-attr="{ pk: 'mall_playx_user_asset.id', field: 'username', remoteUrl: '/admin/mall.PlayxUserAsset/select' }"
|
:input-attr="{ pk: 'mall_user_asset.id', field: 'username', remoteUrl: '/admin/mall.UserAsset/select' }"
|
||||||
:placeholder="t('Please select field', { field: t('mall.pintsOrder.playx_user_asset_id') })"
|
:placeholder="t('Please select field', { field: t('mall.pintsOrder.playx_user_asset_id') })"
|
||||||
/>
|
/>
|
||||||
<FormItem
|
<FormItem
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
type="remoteSelect"
|
type="remoteSelect"
|
||||||
v-model="baTable.form.items!.playx_user_asset_id"
|
v-model="baTable.form.items!.playx_user_asset_id"
|
||||||
prop="playx_user_asset_id"
|
prop="playx_user_asset_id"
|
||||||
:input-attr="{ pk: 'mall_playx_user_asset.id', field: 'username', remoteUrl: '/admin/mall.PlayxUserAsset/select' }"
|
:input-attr="{ pk: 'mall_user_asset.id', field: 'username', remoteUrl: '/admin/mall.UserAsset/select' }"
|
||||||
:placeholder="t('Please select field', { field: t('mall.redemptionOrder.playx_user_asset_id') })"
|
:placeholder="t('Please select field', { field: t('mall.redemptionOrder.playx_user_asset_id') })"
|
||||||
/>
|
/>
|
||||||
<FormItem
|
<FormItem
|
||||||
|
|||||||
67
web/src/views/backend/mall/userAsset/index.vue
Normal file
67
web/src/views/backend/mall/userAsset/index.vue
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<template>
|
||||||
|
<div class="default-main ba-table-box">
|
||||||
|
<el-alert class="ba-table-alert" v-if="baTable.table.remark" :title="baTable.table.remark" type="info" show-icon />
|
||||||
|
|
||||||
|
<TableHeader
|
||||||
|
:buttons="['refresh', 'comSearch', 'quickSearch', 'columnDisplay']"
|
||||||
|
:quick-search-placeholder="t('Quick search placeholder', { fields: t('mall.userAsset.quick Search Fields') })"
|
||||||
|
></TableHeader>
|
||||||
|
|
||||||
|
<Table ref="tableRef"></Table>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted, provide, useTemplateRef } from 'vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { baTableApi } from '/@/api/common'
|
||||||
|
import TableHeader from '/@/components/table/header/index.vue'
|
||||||
|
import Table from '/@/components/table/index.vue'
|
||||||
|
import baTableClass from '/@/utils/baTable'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'mall/userAsset',
|
||||||
|
})
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
const tableRef = useTemplateRef('tableRef')
|
||||||
|
|
||||||
|
const baTable = new baTableClass(
|
||||||
|
new baTableApi('/admin/mall.UserAsset/'),
|
||||||
|
{
|
||||||
|
pk: 'id',
|
||||||
|
column: [
|
||||||
|
{ type: 'selection', align: 'center', operator: false },
|
||||||
|
{ label: t('mall.userAsset.id'), prop: 'id', align: 'center', width: 70, operator: 'RANGE', sortable: 'custom' },
|
||||||
|
{ label: t('mall.userAsset.username'), prop: 'username', align: 'center', operatorPlaceholder: t('Fuzzy query'), sortable: false, operator: 'LIKE' },
|
||||||
|
{ label: t('mall.userAsset.phone'), prop: 'phone', align: 'center', operatorPlaceholder: t('Fuzzy query'), sortable: false, operator: 'LIKE' },
|
||||||
|
{ label: t('mall.userAsset.playx_user_id'), prop: 'playx_user_id', align: 'center', operatorPlaceholder: t('Fuzzy query'), sortable: false, operator: 'LIKE' },
|
||||||
|
{ label: t('mall.userAsset.locked_points'), prop: 'locked_points', align: 'center', operator: 'RANGE', sortable: false },
|
||||||
|
{ label: t('mall.userAsset.available_points'), prop: 'available_points', align: 'center', operator: 'RANGE', sortable: false },
|
||||||
|
{ label: t('mall.userAsset.today_limit'), prop: 'today_limit', align: 'center', operator: 'RANGE', sortable: false },
|
||||||
|
{ label: t('mall.userAsset.today_claimed'), prop: 'today_claimed', align: 'center', operator: 'RANGE', sortable: false },
|
||||||
|
{ label: t('mall.userAsset.today_limit_date'), prop: 'today_limit_date', align: 'center', render: 'date', operator: 'RANGE', comSearchRender: 'date', sortable: 'custom', width: 120, operatorPlaceholder: t('Fuzzy query') },
|
||||||
|
{ label: t('mall.userAsset.create_time'), prop: 'create_time', align: 'center', render: 'datetime', operator: 'RANGE', comSearchRender: 'datetime', sortable: 'custom', width: 160, timeFormat: 'yyyy-mm-dd hh:MM:ss' },
|
||||||
|
{ label: t('mall.userAsset.update_time'), prop: 'update_time', align: 'center', render: 'datetime', operator: 'RANGE', comSearchRender: 'datetime', sortable: 'custom', width: 160, timeFormat: 'yyyy-mm-dd hh:MM:ss' },
|
||||||
|
],
|
||||||
|
dblClickNotEditColumn: [undefined],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
defaultItems: {},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
provide('baTable', baTable)
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
baTable.table.ref = tableRef.value
|
||||||
|
baTable.mount()
|
||||||
|
baTable.getData()?.then(() => {
|
||||||
|
baTable.initSort()
|
||||||
|
baTable.dragSort()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
||||||
|
|
||||||
Reference in New Issue
Block a user