命令行

This commit is contained in:
2025-08-15 10:28:58 +08:00
parent ca0bf11b55
commit d1bbbab7c3
5 changed files with 18 additions and 17 deletions

View File

@@ -13,7 +13,6 @@ use think\Model;
class Course extends Model class Course extends Model
{ {
public static function selectCourse($data) public static function selectCourse($data)
{ {
@@ -32,7 +31,7 @@ class Course extends Model
return returnSuccessData($cache); return returnSuccessData($cache);
} }
$page = ($data['page'] - 1) * $data['limit']; $page = ($data['page'] - 1) * $data['limit'];
$db = $data_db = Db::connect(config('database.search_library'))->name('course'); $db = $data_db = Db::connect(config('think-orm.search_library'))->name('course');
$db = $db->where(['status' => 1]); $db = $db->where(['status' => 1]);
$count = $db->count(); $count = $db->count();
$data_db = $data_db->limit($page, $data['limit']); $data_db = $data_db->limit($page, $data['limit']);
@@ -104,7 +103,7 @@ class Course extends Model
])->limit(page($get['page'], $get['limit']), $get['limit'])->select(); ])->limit(page($get['page'], $get['limit']), $get['limit'])->select();
} }
$is_arr = self::sacouresdata($result); $is_arr = self::sacouresdata($result);
$db = Db::connect(config('database.search_library')); $db = Db::connect(config('think-orm.search_library'));
$course = $db->name('course')->whereIn('course_id', $is_arr['course_id'])->select(); $course = $db->name('course')->whereIn('course_id', $is_arr['course_id'])->select();
$course_arr = self::sacouresdata($result, $course); $course_arr = self::sacouresdata($result, $course);
// 拿详情 // 拿详情
@@ -192,9 +191,9 @@ class Course extends Model
if(empty($get['page']) || empty($get['limit']) || empty($get['randomNum'])) { if(empty($get['page']) || empty($get['limit']) || empty($get['randomNum'])) {
return returnErrorData('参数不完整'); return returnErrorData('参数不完整');
} }
$sale = config('database.db_map'); $sale = config('think-orm.db_map');
foreach ($sale as $k => $v) { foreach ($sale as $k => $v) {
if(in_array($v, config('database.unset_db_map'))) { if(in_array($v, config('think-orm.unset_db_map'))) {
unset($sale[$k]); unset($sale[$k]);
} }
} }
@@ -288,7 +287,7 @@ class Course extends Model
} }
$courseId = $get['courseId']; $courseId = $get['courseId'];
// 获取短剧详情 // 获取短剧详情
$dd_b = Db::connect(config('database.search_library')); $dd_b = Db::connect(config('think-orm.search_library'));
$db_name = $dd_b->name('course'); $db_name = $dd_b->name('course');
$bean = $db_name->where(['course_id' => $courseId])->find(); $bean = $db_name->where(['course_id' => $courseId])->find();
$dd_b->close(); $dd_b->close();
@@ -433,7 +432,7 @@ class Course extends Model
$weekView = Common::getCourseWeekViewCount($course['course_id']); $weekView = Common::getCourseWeekViewCount($course['course_id']);
} }
$db_name = Db::connect(config('database.z_library'))->name('course'); $db_name = Db::connect(config('think-orm.z_library'))->name('course');
// 4. 执行数据库更新 // 4. 执行数据库更新
$db_name->where(['course_id' => $course['course_id']])->update([ $db_name->where(['course_id' => $course['course_id']])->update([
'view_counts' => $viewCounts, 'view_counts' => $viewCounts,

View File

@@ -18,7 +18,7 @@ class Msg extends Model
} }
$send_time = Cache::get($event . $phone); $send_time = Cache::get($event . $phone);
if($send_time && time() - $send_time < 60) { if($send_time && time() - $send_time < 60) {
// return returnErrorData('发送频繁请稍后再试'); return returnErrorData('发送频繁请稍后再试', 500);
}else { }else {
Cache::set($event . $phone, time()); Cache::set($event . $phone, time());
} }
@@ -26,22 +26,22 @@ class Msg extends Model
switch ($event) { switch ($event) {
case 'bindWx': case 'bindWx':
if($user && $user['wx_open_id']) { if($user && $user['wx_open_id']) {
return returnErrorData('当前手机号已被其他微信账号绑定'); return returnErrorData('当前手机号已被其他微信账号绑定', 500);
} }
break; break;
case 'bindIos': case 'bindIos':
if($user && $user['apple_id']) { if($user && $user['apple_id']) {
return returnErrorData('当前手机号已被其他苹果账号绑定'); return returnErrorData('当前手机号已被其他苹果账号绑定', 500);
} }
break; break;
case 'login': case 'login':
if($user) { if($user) {
return returnErrorData('当前手机号已注册'); return returnErrorData('当前手机号已注册', 500);
} }
break; break;
case 'forget': case 'forget':
if(!$user) { if(!$user) {
return returnErrorData('手机号未注册'); return returnErrorData('手机号未注册', 500);
} }
break; break;
} }
@@ -49,7 +49,7 @@ class Msg extends Model
if($commonInfo && $commonInfo->value == 2) { if($commonInfo && $commonInfo->value == 2) {
return self::AlibabaSendMsg($event, $phone); return self::AlibabaSendMsg($event, $phone);
}else { }else {
return returnErrorData('配置错误'); return returnErrorData('配置错误', 500);
} }
} }

View File

@@ -15,7 +15,7 @@ use app\common\library\Auth as UserAuth;
class CommonController extends Frontend class CommonController extends Frontend
{ {
protected array $noNeedLogin = ['getAppUseKv', 'getAppUseKv']; protected array $noNeedLogin = ['getAppUseKv', 'type'];
/** /**
* 图形验证码 * 图形验证码
* @throws Throwable * @throws Throwable
@@ -98,7 +98,7 @@ class CommonController extends Frontend
public function type() public function type()
{ {
$type = $this->request->route('num'); $type = $this->request->route->param('num');
$data = convertToCamelCase(Db::connect(config('think-orm.search_library'))->name('common_info')->where('type', $type)->find()); $data = convertToCamelCase(Db::connect(config('think-orm.search_library'))->name('common_info')->where('type', $type)->find());
$this->success('ok', $data, 0); $this->success('ok', $data, 0);
} }

View File

@@ -540,9 +540,9 @@ if (!function_exists('p')) {
if (!function_exists('returnErrorData')) { if (!function_exists('returnErrorData')) {
function returnErrorData($msg) function returnErrorData($msg, $code = -1)
{ {
return ['code' => -1, 'message' => $msg, 'data' => []]; return ['code' => $code, 'message' => $msg, 'msg' => $msg, 'data' => []];
} }
} }

View File

@@ -15,7 +15,9 @@
use Webman\Route; use Webman\Route;
Route::any('/czg/app/wuyou/queryOrder/{orderId}', [app\czg\app\controller\WuyouController::class, 'queryOrder']); Route::any('/czg/app/wuyou/queryOrder/{orderId}', [app\czg\app\controller\WuyouController::class, 'queryOrder']);
Route::any('/czg/app/wuyou/payOrder/{orderId}', [app\czg\app\controller\WuyouController::class, 'payOrder']);
Route::any('/czg/app/Login/sendMsg/{phone}/{event}', [app\czg\app\controller\LoginController::class, 'sendMsg']); Route::any('/czg/app/Login/sendMsg/{phone}/{event}', [app\czg\app\controller\LoginController::class, 'sendMsg']);
Route::any('/czg/app/common/type/{num}', [app\czg\app\controller\CommonController::class, 'type']);