diff --git a/application/admin/controller/school/activity/Activity.php b/application/admin/controller/school/activity/Activity.php
index 86af1c3..86d84b9 100644
--- a/application/admin/controller/school/activity/Activity.php
+++ b/application/admin/controller/school/activity/Activity.php
@@ -44,12 +44,12 @@ class Activity extends Backend
$this->view->assign("addTypeList", $this->model->getAddTypeList());
$this->view->assign("feelList", $this->model->getFeelList());
$this->view->assign("authStatusList", $this->model->getAuthStatusList());
-
+ $this->view->assign("showList", $this->model->getShowList());
$this->view->assign("cateList", $this->model->getCateList());
$this->view->assign("cateListJson", json_encode($this->model->getCateList(), JSON_UNESCAPED_UNICODE));
-
-
+ $this->view->assign("platformList", $this->model->getPlatformList());
+ $this->view->assign("platformListJson", json_encode($this->model->getPlatformList(), JSON_UNESCAPED_UNICODE));
}
diff --git a/application/admin/lang/zh-cn/school/activity/activity.php b/application/admin/lang/zh-cn/school/activity/activity.php
index 55c8e60..0a2a66f 100644
--- a/application/admin/lang/zh-cn/school/activity/activity.php
+++ b/application/admin/lang/zh-cn/school/activity/activity.php
@@ -76,4 +76,10 @@ return [
'Admin.nickname' => '昵称',
'Admin.avatar' => '头像',
"Refund_id" => '退款策略',
+ 'Show' => '显示状态',
+ 'Show 1' => '显示',
+ 'Show 2' => '隐藏',
+ "Platform" => '上架平台',
+ "Platform wechat_miniapp" => '微信小程序',
+ "Platform tt_miniapp" => '抖音小程序',
];
diff --git a/application/admin/model/school/activity/Activity.php b/application/admin/model/school/activity/Activity.php
index 9db30fa..aadbced 100644
--- a/application/admin/model/school/activity/Activity.php
+++ b/application/admin/model/school/activity/Activity.php
@@ -38,9 +38,25 @@ class Activity extends Model
'feel_text',
'auth_status_text',
'auth_time_text',
+ 'show_text',
'canceltime_text'
];
+ public function getShowList()
+ {
+ return ['1' => __('Show 1'), '2' => __('Show 2')];
+ }
+
+
+ public function getShowTextAttr($value, $data)
+ {
+ $value = $value ? $value : (isset($data['show']) ? $data['show'] : '');
+ $list = $this->getShowList();
+ return isset($list[$value]) ? $list[$value] : '';
+ }
+
+
+
public function getCateList(){
return \app\admin\model\school\activity\Cate::column("name", 'id');
@@ -77,6 +93,17 @@ class Activity extends Model
return ['0' => __('Hot 0'), '1' => __('Hot 1')];
}
+ public function getPlatformList(){
+ return ['wechat_miniapp' => __('Platform wechat_miniapp'), 'tt_miniapp' => __('Platform tt_miniapp')];
+ }
+
+ protected function setPlatformAttr($value)
+ {
+ //如果是数组则转成字符串逗号拼接
+ $value = is_array($value) ? implode(',', $value) : $value;
+ return $value;
+ }
+
public function getNewList()
{
return ['0' => __('New 0'), '1' => __('New 1')];
@@ -158,6 +185,9 @@ class Activity extends Model
}
+
+
+
public function getNewTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['new']) ? $data['new'] : '');
diff --git a/application/admin/view/school/activity/activity/add.html b/application/admin/view/school/activity/activity/add.html
index 1ee9842..0a8c0c0 100644
--- a/application/admin/view/school/activity/activity/add.html
+++ b/application/admin/view/school/activity/activity/add.html
@@ -205,6 +205,22 @@
+
+
+
+
+
-
+
+
+
+
+
+
+
diff --git a/application/admin/view/school/activity/activity/edit.html b/application/admin/view/school/activity/activity/edit.html
index f91a36f..bd06975 100644
--- a/application/admin/view/school/activity/activity/edit.html
+++ b/application/admin/view/school/activity/activity/edit.html
@@ -207,6 +207,22 @@
+
+
+
+
+
-
+
+
+
+
+
+
diff --git a/application/admin/view/school/activity/activity/index.html b/application/admin/view/school/activity/activity/index.html
index 2cefc28..bea6cca 100644
--- a/application/admin/view/school/activity/activity/index.html
+++ b/application/admin/view/school/activity/activity/index.html
@@ -4,6 +4,13 @@
{:build_heading(null,FALSE)}
+
+
- {:__('不筛选审核')}
@@ -58,4 +65,5 @@
diff --git a/application/api/controller/Index.php b/application/api/controller/Index.php
index 95a27a4..169c9fa 100644
--- a/application/api/controller/Index.php
+++ b/application/api/controller/Index.php
@@ -101,6 +101,7 @@ class Index extends Api
"activity_withdrawal_scale" => config("site.activity_withdrawal_scale"),
"unpaid_activity_cancel_time"=> config("site.unpaid_activity_cancel_time"),
"unpaid_activity_expire_time"=> config("site.unpaid_activity_expire_time"),
+ "miniapp_activity_swtich"=> config("site.miniapp_activity_swtich"),
];
$customer_service = [
"image"=>cdnurl(config('site.customer_service_image'),true),
@@ -113,7 +114,18 @@ class Index extends Api
"withdrawal_min"=>config("site.withdrawal_min"),
];
- $this->success('',["withdrawal_info"=>$withdrawal_info,"customer_service"=>$customer_service,"upload_config"=>$upload_config,"base_info"=>$base_info,"home_data"=>$home_data]);
+ $activity_info = [
+ "refund_reason_data" =>array_values(config("site.refund_reason_data")?:[]),
+ ];
+
+ $this->success('',[
+ "withdrawal_info"=>$withdrawal_info,
+ "customer_service"=>$customer_service,
+ "upload_config"=>$upload_config,
+ "base_info"=>$base_info,
+ "home_data"=>$home_data,
+ "activity_info"=>$activity_info,
+ ]);
}
/**
diff --git a/application/api/controller/User.php b/application/api/controller/User.php
index 9c24e87..d0f47d3 100644
--- a/application/api/controller/User.php
+++ b/application/api/controller/User.php
@@ -23,7 +23,7 @@ use app\admin\library\Wechat;
*/
class User extends Api
{
- protected $noNeedLogin = ["registerLogin",'getOpenid','decodeData','login', 'mobilelogin', 'register', 'resetpwd', 'changeemail', 'changemobile', 'third'];
+ protected $noNeedLogin = ["registerLogin","getTtOpenid","decodeTtData",'getOpenid','decodeData','login', 'mobilelogin', 'register', 'resetpwd', 'changeemail', 'changemobile', 'third'];
protected $noNeedRight = '*';
protected $miniConfig;
@@ -39,9 +39,64 @@ class User extends Api
+ /**
+ * @ApiTitle(获取抖音小程序openid信息)
+ * @ApiSummary(根据前端code换取openid信息)
+ * @ApiRoute(/api/user/getTtOpenid)
+ * @ApiMethod(GET)
+ * @ApiParams(name="code",type="string",required=true,description="前端code值")
+ * @ApiReturnParams(name="code", type="integer",required=true, sample="0")
+ * @ApiReturnParams(name="msg", type="string",required=true, sample="获取成功")
+ * @ApiReturnParams(name="data", type="bject",required=true, description= "扩展数据")
+ * @ApiReturn({
+ "code" => 1,
+ "msg" => "获取成功",
+ "data" => {}
+ *})
+ */
+
+ public function getTtOpenid(){
+ $code = $this->request->param('code/s');
+
+ //获取配置
+ $appId = config("site.tt_app_key"); // 替换为你的抖音小程序 AppID
+ $appSecret = config("site.tt_app_secret"); // 替换为你的抖音小程序 AppSecret
+
+ try {
+
+ $url = "https://developer.toutiao.com/api/apps/jscode2session?appid={$appId}&secret={$appSecret}&code={$code}";
+
+ $response = file_get_contents($url);
+ $data = json_decode($response, true);
+
+ if (isset($data['openid'])) {
+ $result = [
+ 'openid' => $data['openid'],
+ 'unionid' => $data['unionid'] ?? null
+ ];
+ } else {
+ $result = $data;
+ }
+
+
+ } catch (\WeChat\Exceptions\LocalCacheException $e){
+ $this->error($e->getMessage());
+ } catch (\Exception $e){
+ $this->error($e->getMessage());
+ }
+ if(empty($result['openid'])){
+ $this->error(__('获取openid失败'),$result);
+ }
+
+ Cache::set('tt_miniapp_code'.$code.$result['openid'],"1",60);
+ $this->success('',$result);
+ }
+
+
+
/**
- * @ApiTitle(获取小程序openid信息)
+ * @ApiTitle(获取微信小程序openid信息)
* @ApiSummary(根据前端code换取openid信息)
* @ApiRoute(/api/user/getOpenid)
* @ApiMethod(GET)
@@ -77,8 +132,8 @@ class User extends Api
}
/**
- * @ApiTitle(加密信息解密)
- * @ApiSummary(解密微信信息)
+ * @ApiTitle(微信加密信息解密)
+ * @ApiSummary(微信解密微信信息)
* @ApiRoute(/api/user/decodeData)
* @ApiMethod(POST)
* @ApiParams(name = "iv", type = "string",required=true)
@@ -107,6 +162,89 @@ class User extends Api
+ /**
+ * @ApiTitle(抖音小程序加密信息解密)
+ * @ApiSummary(解密抖音小程序返回的加密数据)
+ * @ApiRoute(/api/user/decodeTtData)
+ * @ApiMethod(POST)
+ * @ApiParams(name = "iv", type = "string", required=true, description="初始向量")
+ * @ApiParams(name = "encryptedData", type = "string", required=true, description="加密数据")
+ * @ApiParams(name = "sessionKey", type = "string", required=true, description="会话密钥")
+ * @ApiReturn({
+ "code" => 1,
+ "msg" => "获取成功",
+ "data" => {}
+ *})
+ */
+ public function decodeTtData()
+ {
+ $iv = $this->request->param('iv/s');
+ $encryptedData = $this->request->param('encryptedData/s');
+ $sessionKey = $this->request->param('sessionKey/s');
+
+ if (empty($iv) || empty($encryptedData) || empty($sessionKey)) {
+ $this->error(__('参数缺失'));
+ }
+
+ try {
+ // 调用服务层进行解密
+ $result = $this->decryptTtData($encryptedData, $sessionKey, $iv);
+
+ // 缓存手机号(如存在)
+ $phoneNumber = $result['phoneNumber'] ?? ($result['purePhoneNumber'] ?? '');
+ if ($phoneNumber) {
+ Cache::set("tt_miniapp_core{$phoneNumber}", "1", 60);
+ }
+
+ $this->success('解密成功', $result);
+ } catch (\Exception $e) {
+ $this->error("解密失败:" . $e->getMessage());
+ }
+ }
+
+
+
+
+
+ /**
+ * 抖音小程序数据解密
+ *
+ * @param string $encryptedData 加密数据
+ * @param string $sessionKey 会话密钥
+ * @param string $iv 初始向量
+ * @return array 解密后的用户数据
+ * @throws Exception
+ */
+ protected function decryptTtData(string $encryptedData, string $sessionKey, string $iv): array
+ {
+ // base64 decode
+ $sessionKey = base64_decode($sessionKey);
+ $iv = base64_decode($iv);
+ $encrypted = base64_decode($encryptedData);
+
+ // 解密
+ $decrypted = openssl_decrypt($encrypted, 'AES-128-CBC', $sessionKey, OPENSSL_RAW_DATA, $iv);
+
+ if (!$decrypted) {
+ throw new Exception('解密失败:openssl_decrypt 错误');
+ }
+
+ // 去除 PKCS7 填充
+ $pad = ord($decrypted[strlen($decrypted) - 1]);
+ $decrypted = substr($decrypted, 0, strlen($decrypted) - $pad);
+
+ // 提取 JSON 数据
+ $data = json_decode($decrypted, true);
+
+ if (json_last_error() !== JSON_ERROR_NONE) {
+ throw new Exception('JSON 解析失败');
+ }
+
+ return $data;
+ }
+
+
+
/**
* @ApiTitle(微信小程序授权登录注册通用[支持静默登录])
* @ApiSummary(登录注册通用-支持静默登录)
@@ -115,7 +253,7 @@ class User extends Api
* @ApiParams(name = "mobile", type = "string",required=false,description = "mobile 静默非必传,手机授权必传")
* @ApiParams(name = "unionid", type = "string",required=false, description = "unionid 非必传")
* @ApiParams(name = "apptype", type = "string",required=false, description = "应用类型默认miniapp")
- * @ApiParams(name = "platform", type = "string",require=false, description = "平台标识默认wechat")
+ * @ApiParams(name = "platform", type = "string",require=false, description = "平台标识默认wechat微信 ,tt抖音")
* @ApiParams(name = "openid", type = "string", require=true, description = "授权的openid")
* @ApiParams(name = "keeptime", type = "string", require=false, description = "token保持时间,默认0永久")
* @ApiParams(name = "code", type = "string", require=true, description = "授权的code")
diff --git a/application/api/controller/school/Message.php b/application/api/controller/school/Message.php
index a00ab80..65ca243 100644
--- a/application/api/controller/school/Message.php
+++ b/application/api/controller/school/Message.php
@@ -10,7 +10,7 @@ use app\common\model\school\classes\Teacher as Teachermodel;
*/
class Message extends Base
{
- protected $noNeedLogin = ['message_count'];
+ protected $noNeedLogin = ['message_count',"message_list"];
protected $noNeedRight = '*';
protected $model = null;
@@ -78,7 +78,7 @@ class Message extends Base
*/
public function message_list()
{
- $user_id = 0;
+ $user_id = -1;
$user = $this->auth->getUser();//登录用户
if($user)$user_id = $user['id'];
$page = $this->request->get('page/d', 0); //页数
diff --git a/application/api/controller/school/NewActivity.php b/application/api/controller/school/NewActivity.php
index b357faa..9696ab1 100644
--- a/application/api/controller/school/NewActivity.php
+++ b/application/api/controller/school/NewActivity.php
@@ -77,6 +77,7 @@ class NewActivity extends Base
* @ApiSummary(通用活动大索索列表)
* @ApiMethod(GET)
* @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
+ * @ApiParams(name = "platform", type = "string",required=false,description = "上架平台:wechat_miniapp=微信小程序,tt_miniapp=抖音小程序")
* @ApiParams(name = "my", type = "string",required=true,description = "是否查自己(需登录) 1是 0否")
* @ApiParams(name = "page", type = "string",required=true,description = "页数")
* @ApiParams(name = "limit", type = "string",required=true,description = "条数")
@@ -110,6 +111,9 @@ class NewActivity extends Base
$user = $this->auth->getUser();//登录用户
if($user)$user_id = $user['id'];
$params =[];
+
+ $params["platform"] = $this->request->get('platform/s', ''); //搜索关键字
+
$params["my"] = $this->request->get('my/d', 0); //机构店铺id
$params["my_user_id"] = $user_id;
$params["collect"] = $this->request->get('collect/d', 0); //页数
@@ -245,6 +249,7 @@ class NewActivity extends Base
* @ApiParams(name = "title", type = "string",required=true,description = "标题")
* @ApiParams(name = "sign_time", type = "string",required=true,description = "报名区间示例: 2025-04-08 00:01:00 - 2025-04-08 15:29:00")
* @ApiParams(name = "time", type = "string",required=true,description = "活动区间示例: 2025-04-09 00:01:00 - 2025-04-09 15:29:00")
+ * @ApiParams(name = "platform", type = "string",required=false,description = "上架平台:wechat_miniapp=微信小程序,tt_miniapp=抖音小程序")
* @ApiParams(name = "images", type = "string",required=true,description = "轮播图多值逗号拼接")
* @ApiParams(name = "address", type = "string",required=false,description = "地图定位地址")
* @ApiParams(name = "address_detail", type = "string",required=false,description = "手录详细地址")
@@ -268,6 +273,8 @@ class NewActivity extends Base
$params["cate_ids"] = $this->request->post('cate_ids/s', ''); //课程标签
$params["refund_id"] = $this->request->post('refund_id/d', ''); //课程标签
+ $params["platform"] = $this->request->post('platform/s', 'wechat_miniapp'); //课程标签
+
$params["title"] = $this->request->post('title/s', ''); //老师id
$params["images"] = $this->request->post('images/s', ''); //老师id
@@ -291,6 +298,8 @@ class NewActivity extends Base
//classes_type
try{
+ if(!config("site.miniapp_activity_swtich")) $this->error("已关闭发布渠道,请联系管理员后台添加!");
+
$res = $this->model->add($params,$user_id,'user',$user_id,true);
}catch (\Throwable $e){
$this->error($e->getMessage());
diff --git a/application/common/listener/activity/OrderHook.php b/application/common/listener/activity/OrderHook.php
index d09429e..718bd81 100644
--- a/application/common/listener/activity/OrderHook.php
+++ b/application/common/listener/activity/OrderHook.php
@@ -28,7 +28,7 @@ class OrderHook
//记录订单日志
$mini_type = "activity_order";
$to_id = $order["user_id"];
- $status ="activity";
+ $status ="order";
$params=[
"event"=>"activity_order_create_after",
"order_id"=>$order["id"],
@@ -85,7 +85,7 @@ class OrderHook
//记录订单日志
$mini_type = "activity_order";
$to_id = $order["user_id"];
- $status ="activity";
+ $status ="order";
$params=[
"event"=>"activity_order_payed_after",
"order_id"=>$order["id"],
@@ -149,7 +149,7 @@ class OrderHook
//记录订单日志
$mini_type = "activity_order";
$to_id = $order["user_id"];
- $status ="activity";
+ $status ="order";
$params=[
"event"=>"activity_order_verification_after",
"order_id"=>$order["id"],
@@ -208,7 +208,7 @@ class OrderHook
//记录订单日志
$mini_type = "activity_order";
$to_id = $order["user_id"];
- $status ="activity";
+ $status ="order";
$params=[
"event"=>"activity_order_finish_after",
"order_id"=>$order["id"],
@@ -272,7 +272,7 @@ class OrderHook
//记录订单日志
$mini_type = "activity_order";
$to_id = $order["user_id"];
- $status ="activity";
+ $status ="order";
$params=[
"event"=>"activity_order_cancel_after",
"order_id"=>$order["id"],
@@ -326,7 +326,7 @@ class OrderHook
//记录订单日志
$mini_type = "activity_order";
$to_id = $order["user_id"];
- $status ="activity";
+ $status ="order";
$params=[
"event"=>"activity_order_auth_fail_after",
"order_id"=>$order["id"],
@@ -393,7 +393,7 @@ class OrderHook
//记录订单日志
$mini_type = "activity_order";
$to_id = $order["user_id"];
- $status ="activity";
+ $status ="order";
$params=[
"event"=>"activity_order_refund_success_after",
"order_id"=>$order["id"],
@@ -449,7 +449,7 @@ class OrderHook
//记录订单日志
$mini_type = "activity_order";
$to_id = $order["user_id"];
- $status ="activity";
+ $status ="order";
$params=[
"event"=>"activity_order_refund_fail_after",
"order_id"=>$order["id"],
@@ -518,7 +518,7 @@ class OrderHook
//记录订单日志
$mini_type = "activity_order";
$to_id = $order["user_id"];
- $status ="activity";
+ $status ="order";
$params=[
"event"=>"activity_order_after_sales_after",
"order_id"=>$order["id"],
@@ -584,7 +584,7 @@ class OrderHook
//记录订单日志
$mini_type = "activity_order";
$to_id = $order["user_id"];
- $status ="activity";
+ $status ="order";
$params=[
"event"=>"activity_order_shop_confirm_after",
"order_id"=>$order["id"],
@@ -642,7 +642,7 @@ class OrderHook
//记录订单日志
$mini_type = "activity_order";
$to_id = $order["user_id"];
- $status ="activity";
+ $status ="order";
$params=[
"event"=>"activity_order_shop_reject_after",
"order_id"=>$order["id"],
@@ -700,7 +700,7 @@ class OrderHook
//记录订单日志
$mini_type = "activity_order";
$to_id = $order["user_id"];
- $status ="activity";
+ $status ="order";
$params=[
"event"=>"activity_order_timeout_reject_after",
"order_id"=>$order["id"],
diff --git a/application/common/model/school/Message.php b/application/common/model/school/Message.php
index c4c59ed..f1ea4ac 100644
--- a/application/common/model/school/Message.php
+++ b/application/common/model/school/Message.php
@@ -38,7 +38,7 @@ class Message extends BaseModel
public function getCreatetimeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['createtime']) ? $data['createtime'] : '');
- return is_numeric($value) ? date("Y.m.d|H:i", $value) : $value;
+ return is_numeric($value) ? date("Y.m.d H:i:s", $value) : $value;
}
@@ -148,6 +148,14 @@ class Message extends BaseModel
}
+ public function getParamsAttr($value, $data)
+ {
+ //JSON转数组
+ $params = json_decode($value, true);
+ return $params;
+ }
+
+
public static $event_name = "";
@@ -252,7 +260,7 @@ class Message extends BaseModel
$tableFields = (new static)->getTableFields();
foreach ($tableFields as $fields)
{
- if(in_array($fields, ['platform','oper_type','to_type','status','mini_type','to_id']))continue;
+ if(in_array($fields, ['platform','oper_type','to_type',"type",'status','mini_type','to_id']))continue;
// if (isset($whereData[$fields]) && $whereData[$fields]) $model = $model->where("{$alisa}{$fields}", '=', $whereData[$fields]);
if (isset($whereData[$fields]) && $whereData[$fields]){
@@ -266,8 +274,8 @@ class Message extends BaseModel
}
- if (isset($whereData['status'])) $model = $model->where("{$alisa}status", 'in', $whereData['status']);
- if (isset($whereData['not_status'])) $model = $model->where("{$alisa}status", 'not in', $whereData['not_status']);
+ if (isset($whereData['status']) && $whereData['status']!=="") $model = $model->where("{$alisa}status", 'in', $whereData['status']);
+ if (isset($whereData['not_status'])&& $whereData['not_status']!=="") $model = $model->where("{$alisa}status", 'not in', $whereData['not_status']);
if (isset($whereData['keywords'])&&$whereData['keywords']) $model = $model->where("{$alisa}id|{$alisa}title|{$alisa}desc", '=', $whereData['keywords']);
if (isset($whereData['time'])&&$whereData['time']){
$model = $model->time(["{$alisa}createtime",$whereData['time']]);
@@ -286,6 +294,8 @@ class Message extends BaseModel
if (isset($whereData['mini_type']) && $whereData['mini_type']) $model = $model->where("{$alisa}mini_type", 'in', $whereData['mini_type']);
+ if (isset($whereData['type']) && $whereData['type']) $model = $model->where("{$alisa}type", 'in', $whereData['type']);
+
if (isset($whereData['to_id']) && $whereData['to_id']){
$model = $model->where(function ($query) use($whereData,$alisa) {
$query->where("{$alisa}to_id", $whereData['to_id'])
diff --git a/application/common/model/school/activity/Activity.php b/application/common/model/school/activity/Activity.php
index d871bda..bb2a349 100644
--- a/application/common/model/school/activity/Activity.php
+++ b/application/common/model/school/activity/Activity.php
@@ -50,6 +50,17 @@ class Activity extends BaseModel
+ public function getPlatformList(){
+ return ['wechat_miniapp' => __('Platform wechat_miniapp'), 'tt_miniapp' => __('Platform tt_miniapp')];
+ }
+
+ protected function setPlatformAttr($value)
+ {
+ //如果是数组则转成字符串逗号拼接
+ $value = is_array($value) ? implode(',', $value) : $value;
+ return $value;
+ }
+
public function getImagesAttr($value, $data)
{
@@ -688,7 +699,7 @@ class Activity extends BaseModel
$cate_list = Cate::where("status",'1')->column("name","id");
// $label_list = Label::where("status",'1')->column("name","id");
// $type_list = Type::where("status",'1')->column("name","id");
- $selfetch = self::with($with);
+ $selfetch = self::with($with)->where("{$a}show", '=', '1');
@@ -834,10 +845,10 @@ class Activity extends BaseModel
-// if (isset($self_label_tag) && $self_label_tag) {
-// $self_label_tag = implode("|",explode(',',$self_label_tag));
-// $selfetch = $selfetch->whereRaw(" {$a}self_label_tag REGEXP '({$self_label_tag})'");
-// }
+ if (isset($platform) && $platform) {
+ $platform = implode("|",explode(',',$platform));
+ $selfetch = $selfetch->whereRaw(" {$a}platform REGEXP '({$platform})'");
+ }
//
// if (isset($classes_type) && $classes_type) {
// $classes_type = implode("|",explode(',',$classes_type));
diff --git a/application/common/model/school/activity/order/Order.php b/application/common/model/school/activity/order/Order.php
index 03ee36e..05e41c5 100644
--- a/application/common/model/school/activity/order/Order.php
+++ b/application/common/model/school/activity/order/Order.php
@@ -593,6 +593,9 @@ class Order extends BaseModel
if(!$activity ) throw new \Exception("该活动不存在!");
+ //用户存不存在
+ $user_info = User::where('id',$user_id)->find();
+ if(!$user_info) throw new \Exception("用户不存在!");
//默认校验订单是否已创建
if($check){
if($activity['status']!='2' || $activity['auth_status']!='1') throw new \Exception("该活动不在可报名时间段!");
@@ -617,11 +620,21 @@ class Order extends BaseModel
throw new \Exception("活动人数已超{$sub}人!无法下单!");
}
+ //检测当前活动下单总人数是否超过x,x取配置,超出不允许下单(数量记得加上当前下单数量$num)
+ $x = config("site.free_activity_max_people");
+ //查询当前活动下单总人数
+ $activity_order_num = self::where('activity_id',$activity_id)
+ ->where('user_id',$user_id)
+ ->where('status','in',['0','2','3','4','7','9'])->sum( 'num');
+ //修改:免费活动才判断
+ if($activity['feel'] == '1'){
+ if($activity_order_num + $num > $x){
+ throw new \Exception("当前活动您下单的人数已超{$x}人!无法下单!");
+ }
+ }
+
}
- //用户存不存在
- $user_info = User::where('id',$user_id)->find();
- if(!$user_info) throw new \Exception("用户不存在!");
@@ -860,18 +873,23 @@ class Order extends BaseModel
$orderCode["miniurl"] = self::getMiniQrcodeLink(["order_id"=>$order['id'],"code"=>$orderCode["code"]]);
+ $url_params = ["id"=>$order['id'],"code"=>$orderCode["code"]];
+ //转成url参数(?xx&xx)
+ $url_params = http_build_query($url_params);
+
+
//生成核销二维码和一维码
// //生成二维码和一维码
// //二维码
-// $orderCode->codeimage = (Common::getQrcode([
-// 'text' => $orderCode["miniurl"],
-// 'size' => 200,
-// ]))['url'];
-// //一维码
-// $orderCode->codeoneimage = (Common::getBarcode([
-// 'text' => $orderCode["miniurl"],
-// 'size' => 200,
-// ]))['url'];
+ $orderCode->codeimage = (Common::getQrcode([
+ 'text' => $orderCode["miniurl"] . '?' . $url_params,
+ 'size' => 200,
+ ]))['url'];
+ //一维码
+ $orderCode->codeoneimage = (Common::getBarcode([
+ 'text' => $orderCode["miniurl"] . '?' . $url_params,
+ 'size' => 200,
+ ]))['url'];
$orderCode->save();
diff --git a/public/assets/js/backend/school/activity/activity.js b/public/assets/js/backend/school/activity/activity.js
index 712afeb..ca0d4ad 100644
--- a/public/assets/js/backend/school/activity/activity.js
+++ b/public/assets/js/backend/school/activity/activity.js
@@ -39,13 +39,19 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
{field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
{field: 'feel', title: __('Feel'), searchList: {"0":__('Feel 0'),"1":__('Feel 1')}, formatter: Table.api.formatter.normal},
+ {field: 'cate_ids', title: __('Cate_ids'), searchList: cateListJson, formatter: Table.api.formatter.flag},
+ {field: 'platform', title: __('Platform'), searchList: platformListJson, formatter: Table.api.formatter.flag},
+ {field: 'show', title: __('Show'), searchList: {"1":__('Show 1'),"2":__('Show 2')}, formatter: Table.api.formatter.status},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3'),"4":__('Status 4'),"5":__('Status 5'),"-1":__('Status -1')}, formatter: Table.api.formatter.status},
{field: 'auth_status', title: __('Auth_status'), searchList: {"0":__('Auth_status 0'),"1":__('Auth_status 1'),"2":__('Auth_status 2')}, formatter: Table.api.formatter.status},
{field: 'reason', title: __('Reason'), operate: 'LIKE'},
// {field: 'address_city', title: __('Address_city'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
// {field: 'cate_ids', title: __('Cate_ids'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
- {field: 'cate_ids', title: __('Cate_ids'), searchList: cateListJson, formatter: Table.api.formatter.flag},
+
+
+
+
// {field: 'province', title: __('Province')},
// {field: 'city', title: __('City')},
// {field: 'district', title: __('District')},
@@ -233,6 +239,48 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
+
+
+ //自定义Tab筛选条件
+ $('.panel-heading .nav-custom2-condition a[data-toggle="tab"]', table.closest(".panel-intro")).on('shown.bs.tab', function (e) {
+ var value = $(this).data("value");
+ var options = table.bootstrapTable('getOptions');
+ var queryParams = options.queryParams;
+ options.pageNumber = 1;
+ options.queryParams = function (params) {
+ //这一行必须要存在,否则在点击下一页时会丢失搜索栏数据
+ params = queryParams(params);
+
+ //如果希望追加搜索条件,可使用
+ var filter = params.filter ? JSON.parse(params.filter) : {};
+ var op = params.op ? JSON.parse(params.op) : {};
+ if (value!=="") {
+ //这里可以自定义多个筛选条件
+ filter.platform = value;
+ op.platform = 'FIND_IN_SET';
+ }else{
+ //console.log("111111111111111111");
+ //选全部时要移除相应的条件
+ delete filter.platform;
+ delete op.platform;
+ }
+
+ params.filter = JSON.stringify(filter);
+ params.op = JSON.stringify(op);
+
+ //如果希望忽略搜索栏搜索条件,可使用
+ //params.filter = JSON.stringify(value?{admin_id: value}:{});
+ //params.op = JSON.stringify(value?{admin_id: '='}:{});
+ return params;
+ };
+
+ table.trigger("uncheckbox");
+ table.bootstrapTable('refresh', {pageNumber: 1});
+ return false;
+ });
+
+
+
},
recyclebin: function () {
// 初始化表格参数配置