no message
This commit is contained in:
1 parent
f98286d2f6
commit
21292655e5
7 files changed
+153
-42
No files matched your search
@@ -10,19 +10,67 @@ use App\Services\TomTool\PageBar;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Slim\Http\Response;
|
||||
use Slim\Http\ServerRequest;
|
||||
use App\Models\PlanActivated;
|
||||
use App\Models\PlanExpired;
|
||||
use App\Models\PlanPending;
|
||||
//use App\Models\PlanActivated;
|
||||
//use App\Models\PlanExpired;
|
||||
//use App\Models\PlanPending;
|
||||
use App\Models\Product;
|
||||
use App\Models\Order;
|
||||
use App\Services\Db;
|
||||
use voku\helper\AntiXSS;
|
||||
|
||||
final class PlanController extends BaseController
|
||||
{
|
||||
|
||||
public function ajaxPlanLog(ServerRequest $request, Response $response, array $args): ResponseInterface
|
||||
{
|
||||
$iPage = $args['page'] ?? 1;
|
||||
|
||||
$oOrder = Order::where("user_id", $this->user->id)
|
||||
->orderByRaw("CASE
|
||||
WHEN status = 'payment_pending' THEN 1
|
||||
WHEN status = 'activated' THEN 2
|
||||
WHEN status = 'pending' THEN 3
|
||||
WHEN status = 'expired' THEN 4
|
||||
ELSE 5
|
||||
END")
|
||||
->orderBy('id', 'desc') // 按 id 降序排序
|
||||
->paginate(20, ['*'], 'page', $iPage);
|
||||
|
||||
$sPageBar = PageBar::cool($oOrder->lastPage(), $oOrder->currentPage(), "/user/plan/");
|
||||
|
||||
foreach ($oOrder as &$oUserPlanRow) {
|
||||
$oUserPlanRow->created_at = date("Y-m-d H:i:s", $oUserPlanRow->create_time);
|
||||
|
||||
if ($oUserPlanRow->error_str) {
|
||||
$oUserPlanRow->status = $oUserPlanRow->error_str;
|
||||
}
|
||||
|
||||
else if ($oUserPlanRow->status == "payment_pending") {
|
||||
$oUserPlanRow->status = "等待支付";
|
||||
} else if ($oUserPlanRow->status == "activated") {
|
||||
$oUserPlanRow->status = "<span class='text-primary'>使用中</span>";
|
||||
} else if ($oUserPlanRow->status == "pending") {
|
||||
$oUserPlanRow->status = "提前续订";
|
||||
} else if ($oUserPlanRow->status == "expired") {
|
||||
$oUserPlanRow->status = "已过期";
|
||||
}
|
||||
}
|
||||
|
||||
$sView = $this->view()
|
||||
->assign('oUserPlanList', $oOrder)
|
||||
->assign('pageBar', $sPageBar)
|
||||
->fetch('user/plan/ajax_planLog.tpl');
|
||||
|
||||
return $response->withJson([
|
||||
'ret' => 1,
|
||||
'view' => $sView,
|
||||
]);
|
||||
}
|
||||
|
||||
public function ajaxPlanLog__(ServerRequest $request, Response $response, array $args): ResponseInterface
|
||||
{
|
||||
$iPage = $args['page'] ?? 1;
|
||||
|
||||
$activatedPlans = PlanActivated::select('*', DB::raw("'activated' as plan_type"))
|
||||
->where('user_id', $this->user->id);
|
||||
|
||||
@@ -80,6 +128,8 @@ final class PlanController extends BaseController
|
||||
]);
|
||||
}
|
||||
|
||||
// tomd($sProductCode, 1);
|
||||
|
||||
$oProductDetail = Product::where("code", $sProductCode)->first()->toArray();
|
||||
$oProductDetail["content"] = json_decode($oProductDetail["content"], true);
|
||||
|
||||
|
||||
Reference in new issue
Block a user