diff --git a/application/admin/view/school/message_config/add.html b/application/admin/view/school/message_config/add.html
new file mode 100644
index 0000000..cb6a21a
--- /dev/null
+++ b/application/admin/view/school/message_config/add.html
@@ -0,0 +1,129 @@
+
diff --git a/application/admin/view/school/message_config/edit.html b/application/admin/view/school/message_config/edit.html
new file mode 100644
index 0000000..4b257ed
--- /dev/null
+++ b/application/admin/view/school/message_config/edit.html
@@ -0,0 +1,129 @@
+
diff --git a/application/admin/view/school/message_config/index.html b/application/admin/view/school/message_config/index.html
new file mode 100644
index 0000000..3454263
--- /dev/null
+++ b/application/admin/view/school/message_config/index.html
@@ -0,0 +1,46 @@
+
+
+
+ {:build_heading(null,FALSE)}
+
+
+
+
+
+
diff --git a/application/admin/view/school/message_config/recyclebin.html b/application/admin/view/school/message_config/recyclebin.html
new file mode 100644
index 0000000..56e2c25
--- /dev/null
+++ b/application/admin/view/school/message_config/recyclebin.html
@@ -0,0 +1,25 @@
+
+ {:build_heading()}
+
+
+
diff --git a/application/api/controller/school/Message.php b/application/api/controller/school/Message.php
index 57afa73..7330bb5 100644
--- a/application/api/controller/school/Message.php
+++ b/application/api/controller/school/Message.php
@@ -69,7 +69,8 @@ class Message extends Base
* @ApiParams(name = "limit", type = "string",required=true,description = "条数")
* @ApiParams(name = "status", type = "string",required=false,description = "消息总类型:system=系统消息,classes=课程消息,order=订单消息")
* @ApiParams(name = "mini_type", type = "string",required=false,description = "小消息类型:order_notice=课程订单通知,classes_auth=课程报名审核,classes_apply=课程上新审核,shop_apply=机构审核,classes_order_notice=课时预约,user_auth=机构授权用户信息,aftercare=售后服务,other=其他")
- *@ApiParams(name = "type", type = "string",required=false,description = "已读状态:1=未读,2=已读")
+ * @ApiParams(name = "type", type = "string",required=false,description = "已读状态:1=未读,2=已读")
+ * @ApiParams(name = "time", type = "string",required=false,description = "复合时间查询:today今天,week本周,month本月,year本年,yesterday昨天,last year上一年,last week上周,last month上個月,lately7最近7天 , lately30最近30天,按开始时间区间查传值格式:Y/m/d H:M:S-Y/m/d H:M:S")
*
* @ApiReturn({
*
@@ -86,11 +87,12 @@ class Message extends Base
$status = $this->request->get('status/s', ''); //搜索关键字
$mini_type = $this->request->get('mini_type/s', ''); //搜索关键字
$type = $this->request->get('type/s', ''); //搜索关键字
+ $time = $this->request->get('time/s', ''); //时间
// $type = $this->request->get('type/s', ''); //筛选学员和教练单
$to_id = $user_id;
try{
//当前申请状态
- $res = $this->model::messageList($page, $limit,$to_id,$keywords,$status,$mini_type,$type);
+ $res = $this->model::messageList($page, $limit,$to_id,$keywords,$status,$mini_type,$type,$time);
// if($user_id =='670153'){
// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
// }
diff --git a/application/common/controller/Backend.php b/application/common/controller/Backend.php
index c8f5094..b0e0cad 100644
--- a/application/common/controller/Backend.php
+++ b/application/common/controller/Backend.php
@@ -118,6 +118,7 @@ class Backend extends Controller
protected $have_auth = false;
+ protected $need_auth = false;
protected $no_auth_fields = [];
protected function no_auth_fields_check($params,$row){
diff --git a/application/common/controller/ManystoreBase.php b/application/common/controller/ManystoreBase.php
index fa0fe0a..79e5eb2 100644
--- a/application/common/controller/ManystoreBase.php
+++ b/application/common/controller/ManystoreBase.php
@@ -123,6 +123,7 @@ class ManystoreBase extends Controller
protected $have_auth = false;
+ protected $need_auth = false;
protected $no_auth_fields = [];
protected function no_auth_fields_check($params,$row){
diff --git a/application/common/listener/classes/ClassesHook.php b/application/common/listener/classes/ClassesHook.php
index c571635..86450cd 100644
--- a/application/common/listener/classes/ClassesHook.php
+++ b/application/common/listener/classes/ClassesHook.php
@@ -27,6 +27,7 @@ class ClassesHook
"event"=>"classes_auth_need_after",
"classes_lib_id"=>$classes["id"],
];
+ Message::$event_name = $params["event"];
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
@@ -54,6 +55,7 @@ class ClassesHook
"event"=>"classes_auth_success_after",
"classes_lib_id"=>$classes["id"],
];
+ Message::$event_name = $params["event"];
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
}
@@ -79,6 +81,7 @@ class ClassesHook
"event"=>"classes_auth_success_after",
"classes_lib_id"=>$classes["id"],
];
+ Message::$event_name = $params["event"];
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
diff --git a/application/common/listener/classeshourorder/OrderHook.php b/application/common/listener/classeshourorder/OrderHook.php
index c6a0f0d..455c6de 100644
--- a/application/common/listener/classeshourorder/OrderHook.php
+++ b/application/common/listener/classeshourorder/OrderHook.php
@@ -40,6 +40,7 @@ class OrderHook
"order_id"=>$order["id"],
"order_no"=>$order["order_no"],
];
+ Message::$event_name = $params["event"];
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
}
@@ -70,6 +71,7 @@ class OrderHook
"order_id"=>$order["id"],
"order_no"=>$order["order_no"],
];
+ Message::$event_name = $params["event"];
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
@@ -104,6 +106,7 @@ class OrderHook
"order_id"=>$order["id"],
"order_no"=>$order["order_no"],
];
+ Message::$event_name = $params["event"];
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
}
@@ -135,6 +138,7 @@ class OrderHook
"order_no"=>$order["order_no"],
"reason"=>$order['reason']
];
+ Message::$event_name = $params["event"];
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
@@ -166,6 +170,7 @@ class OrderHook
"order_id"=>$order["id"],
"order_no"=>$order["order_no"],
];
+ Message::$event_name = $params["event"];
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
@@ -199,6 +204,7 @@ class OrderHook
"order_id"=>$order["id"],
"order_no"=>$order["order_no"],
];
+ Message::$event_name = $params["event"];
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
diff --git a/application/common/listener/classesorder/OrderHook.php b/application/common/listener/classesorder/OrderHook.php
index ca68ebb..f524e09 100644
--- a/application/common/listener/classesorder/OrderHook.php
+++ b/application/common/listener/classesorder/OrderHook.php
@@ -34,6 +34,7 @@ class OrderHook
"order_id"=>$order["id"],
"order_no"=>$order["order_no"],
];
+ Message::$event_name = $params["event"];
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
@@ -64,6 +65,7 @@ class OrderHook
"order_no"=>$order["order_no"],
"classes_lib_id"=>$order["classes_lib_id"],
];
+ Message::$event_name = $params["event"];
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
@@ -94,6 +96,7 @@ class OrderHook
"order_id"=>$order["id"],
"order_no"=>$order["order_no"],
];
+ Message::$event_name = $params["event"];
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
}
@@ -122,6 +125,7 @@ class OrderHook
"order_no"=>$order["order_no"],
"classes_lib_id"=>$order["classes_lib_id"],
];
+ Message::$event_name = $params["event"];
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
}
diff --git a/application/common/listener/manystore/ShopHook.php b/application/common/listener/manystore/ShopHook.php
index 47b4a7c..82edf23 100644
--- a/application/common/listener/manystore/ShopHook.php
+++ b/application/common/listener/manystore/ShopHook.php
@@ -67,6 +67,7 @@ class ShopHook
"shop_id"=>$shop["id"],
"desc"=>$shop["desc"],
];
+ Message::$event_name = $params["event"];
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
@@ -102,6 +103,7 @@ class ShopHook
"shop_id"=>$shop["id"],
"desc"=>$shop["desc"],
];
+ Message::$event_name = $params["event"];
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
@@ -131,6 +133,7 @@ class ShopHook
"shop_id"=>$shop["id"],
"desc"=>$shop["desc"],
];
+ Message::$event_name = $params["event"];
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
diff --git a/application/common/model/BaseModel.php b/application/common/model/BaseModel.php
index b029151..4735c09 100644
--- a/application/common/model/BaseModel.php
+++ b/application/common/model/BaseModel.php
@@ -77,7 +77,8 @@ class BaseModel extends Model
public function no_auth_fields_check($params,$row){
-
+ $this->getTableFields();
+ $params = $this->checkAssemblyParameters($params);
foreach ($params as $k=>$v){
//说明数值有变动
@@ -87,7 +88,7 @@ class BaseModel extends Model
if($row[$k]!=$params[$k]){
//当修改参数不在允许修改的字段中
if(!in_array($k,$this->no_auth_fields)){
-
+// var_dump($row[$k],$params[$k]);
$this->have_auth = true;break;
}
diff --git a/application/common/model/school/Message.php b/application/common/model/school/Message.php
index 2899263..c127b38 100644
--- a/application/common/model/school/Message.php
+++ b/application/common/model/school/Message.php
@@ -131,6 +131,16 @@ class Message extends BaseModel
return $this->belongsTo('app\admin\model\User', 'to_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
+
+ public function messageevent()
+ {
+ return $this->belongsTo(MessageConfig::class, 'event', 'event', [], 'LEFT')->setEagerlyType(0);
+ }
+
+
+
+ public static $event_name = "";
+
/** 发送站内信
* @param $title 站内信标题
* @param $desc 内容
@@ -156,6 +166,7 @@ class Message extends BaseModel
'to_type' => $to_type,
'status' => $status,
'mini_type' => $mini_type,
+ "event" =>self::$event_name ?? "",
];
$message = new self();
$message->save($data);
@@ -196,6 +207,8 @@ class Message extends BaseModel
$data->save();
}
+ //
+ $data->messageevent;
// //加载订单详情
// $data->detail->teacher;
// //订单用户
@@ -247,7 +260,7 @@ class Message extends BaseModel
if (isset($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($whereData['time']);
+ $model = $model->time(['createtime',$whereData['time']]);
}
if (isset($whereData['user_id']) && $whereData['user_id']) $model = $model->where("{$alisa}to_id", '=', $whereData['user_id']);
@@ -268,7 +281,6 @@ class Message extends BaseModel
$query->where("{$alisa}to_id", $whereData['to_id'])
->whereOr("{$alisa}to_id", '=', 0);
});
-
}
@@ -305,9 +317,10 @@ class Message extends BaseModel
- public static function messageList($page, $limit,$to_id,$keywords,$status,$mini_type,$type){
+ public static function messageList($page, $limit,$to_id,$keywords,$status,$mini_type,$type,$time=null){
$with_field = [
'user'=>['nickname','mobile','avatar','realname'],
+ 'messageevent'=>['event','logo_image'],
'base'=>['*'],
// 'shop'=>['*'],
// 'detail'=>['*'],
@@ -316,7 +329,7 @@ class Message extends BaseModel
$alisa = (new self)->getWithAlisaName();
$sort = "{$alisa}.weigh desc,{$alisa}.id desc";
// $sort = "field({$alisa}.type,'1','2') asc,{$alisa}.weigh desc,{$alisa}.id desc";
- $serch_where = ["to_id"=>$to_id,'platform'=>"user",'status'=>$status,'keywords'=>$keywords,"mini_type"=>$mini_type,"type"=>$type];
+ $serch_where = ["to_id"=>$to_id,'platform'=>"user",'status'=>$status,'keywords'=>$keywords,"mini_type"=>$mini_type,"type"=>$type,"time"=>$time];
// if($type)$serch_where['type'] = $type;
return (new self)->getBaseList($serch_where, $page, $limit,$sort,$with_field);
}
diff --git a/application/common/model/school/MessageConfig.php b/application/common/model/school/MessageConfig.php
new file mode 100644
index 0000000..98dffce
--- /dev/null
+++ b/application/common/model/school/MessageConfig.php
@@ -0,0 +1,107 @@
+getPk();
+ $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
+ }
+ });
+ }
+
+
+ public function getStatusList()
+ {
+ return ['1' => __('Status 1'), '2' => __('Status 2')];
+ }
+
+ public function getWechatWapList()
+ {
+ return ['1' => __('Wechat_wap 1'), '2' => __('Wechat_wap 2')];
+ }
+
+ public function getMessageList()
+ {
+ return ['1' => __('Message 1'), '2' => __('Message 2')];
+ }
+
+ public function getSelfmailList()
+ {
+ return ['1' => __('Selfmail 1'), '2' => __('Selfmail 2')];
+ }
+
+
+ public function getStatusTextAttr($value, $data)
+ {
+ $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
+ $list = $this->getStatusList();
+ return isset($list[$value]) ? $list[$value] : '';
+ }
+
+
+ public function getWechatWapTextAttr($value, $data)
+ {
+ $value = $value ? $value : (isset($data['wechat_wap']) ? $data['wechat_wap'] : '');
+ $list = $this->getWechatWapList();
+ return isset($list[$value]) ? $list[$value] : '';
+ }
+
+
+ public function getMessageTextAttr($value, $data)
+ {
+ $value = $value ? $value : (isset($data['message']) ? $data['message'] : '');
+ $list = $this->getMessageList();
+ return isset($list[$value]) ? $list[$value] : '';
+ }
+
+
+ public function getSelfmailTextAttr($value, $data)
+ {
+ $value = $value ? $value : (isset($data['selfmail']) ? $data['selfmail'] : '');
+ $list = $this->getSelfmailList();
+ return isset($list[$value]) ? $list[$value] : '';
+ }
+
+
+ public function getLogoImageAttr($value, $data)
+ {
+ if (!empty($value)) return cdnurl($value, true);
+ }
+
+
+
+
+}
diff --git a/application/common/model/school/classes/ClassesLib.php b/application/common/model/school/classes/ClassesLib.php
index 4452ea5..016aadb 100644
--- a/application/common/model/school/classes/ClassesLib.php
+++ b/application/common/model/school/classes/ClassesLib.php
@@ -872,6 +872,7 @@ $user_unpaid_order = $user_paid_order =null;
if(!$this->no_auth_fields_check($params,$row)){
return true;
}
+
}
// 课程存在未完成订单则不允许操作
@@ -891,7 +892,7 @@ $user_unpaid_order = $user_paid_order =null;
{
$params["auth_status"] = $params["auth_status"] ?? '0';
$params["status"] = $params["status"] ?? '3';
-
+ if(!$shop_id)$shop_id = $params["shop_id"] ?? 0;
$manystore = Manystore::where("shop_id",$shop_id)->find();
@@ -1008,23 +1009,77 @@ $user_unpaid_order = $user_paid_order =null;
}
+
+ //如果存在课程规格,验证每个课时规格的合法性
+ if(isset($params["spec"])){
+ //如果存在"的HTML转义字符,先反转义再解析json
+ $params["spec"] = html_entity_decode($params["spec"]);
+ $spec = json_decode($params["spec"],true);
+ if(empty($spec))throw new \Exception("请至少添加一个课时规格");
+
+ foreach ($spec as $k=>&$v){
+ $v["classes_lib_id"] = $row->id;
+ (new ClassesSpec)->specCheck($v,$shop_id,empty($v["id"])? null : ClassesSpec::get($v["id"]));
+
+ }
+ $params["spec"] = $spec;
+ }
+
}else{
//新增
//名称title不能重复
- $check_title = $this->model->where('title',$params["title"])->find();
+ $check_title = self::where('title',$params["title"])->find();
if($check_title){
throw new \Exception("课程名称已存在或被其他机构占用,请更改!");
}
+
+
+ //如果存在课程规格,验证每个课时规格的合法性
+ if(isset($params["spec"])){
+
+ $spec = json_decode($params["spec"],true);
+ if(empty($spec))throw new \Exception("请至少添加一个课时规格");
+
+ foreach ($spec as $k=>&$v){
+ $v["classes_lib_id"] = 0;
+ (new ClassesSpec)->specCheck($v,$shop_id,null);
+ }
+ $params["spec"] = $spec;
+ }
+
}
+ $params["delete_spec_ids"] = [];
+ //按前端顺序分配显示权重
+ if(isset($params["spec"]) && $params["spec"]){
+ //数组倒过来
+ $params["spec"] = array_reverse($params["spec"]);
+ $insert_spec = [];
+ foreach ($params["spec"] as $k=>&$v){
+ $v["weigh"] = $k;
+ if(!empty($v["id"]))$insert_spec[] = $v["id"];
+ }
+ if($insert_spec && $row){
+ $params["delete_spec_ids"] = ClassesSpec::where("classes_lib_id",$row->id)->where("id","not in",$insert_spec)->column("id");
+ }
+ }
+
+ //存在需要删除的规格则判断规格是否能删除
+ if($params["delete_spec_ids"] && $row){
+ $check_spec = \app\common\model\school\classes\ClassesSpec::where("classes_lib_id",$row->id)->where("id","in",$params["delete_spec_ids"])->select();
+ foreach ($check_spec as $k=>$vv){
+ (new \app\common\model\school\classes\ClassesSpec)->updateCheck($vv->id);
+ }
+ $params["delete_spec_ids"] = $check_spec;
+ }
+
//如果是上架,判断是否拥有课时规格,没有则无法上架
- if($params["status"]=="1" && empty($params["spec"])){
+ if(empty($params["spec"])){
if(!$row)throw new \Exception("新添加的课程请先至少添加一个课时规格后再上架!");
//判断是否拥有课时规格,没有则无法上架
$check_spec = \app\common\model\school\classes\ClassesSpec::where("classes_lib_id",$row->id)->count();
if(!$check_spec)throw new \Exception("新添加的课程请先至少添加一个课时规格后再上架!");
-
}
}
diff --git a/application/common/model/school/classes/ClassesSpec.php b/application/common/model/school/classes/ClassesSpec.php
index 7099501..6763d32 100644
--- a/application/common/model/school/classes/ClassesSpec.php
+++ b/application/common/model/school/classes/ClassesSpec.php
@@ -31,11 +31,11 @@ class ClassesSpec extends BaseModel
'status_text'
];
-
+ public $no_auth_fields = ['name','limit_num','status','weigh'];
protected static function init()
{
self::afterInsert(function ($row) {
- if (!$row['weigh']) {
+ if (empty($row['weigh'])) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
}
@@ -87,9 +87,9 @@ class ClassesSpec extends BaseModel
}
- protected function specupdateCheck($id,$params=[],$row=null){
+ public function updateCheck($id,$params=[],$row=null){
if($params && $row){
-
+// var_dump($this->no_auth_fields_check($params,$row));
if(!$this->no_auth_fields_check($params,$row)){
return true;
}
@@ -117,7 +117,7 @@ class ClassesSpec extends BaseModel
if(empty($time))throw new \Exception("请选择开始和结束时间");
$split_line = " - ";
$time_arr = explode($split_line,$time);
- $params["start_time"] = $time_arr[0];
+ $params["start_time"] = $time_arr[0] ;
$params["end_time"] = $time_arr[1];
unset($params["time"]);
@@ -138,14 +138,21 @@ class ClassesSpec extends BaseModel
//结束时间不能是已经过去的时间
$now_time = time();
if($end_time<=$now_time){
- throw new \Exception("结束时间不能是已经过去的时间");
+// throw new \Exception("结束时间不能是已经过去的时间");
}
+ $params["start_time"] = $start_time;
+ $params["end_time"] = $end_time;
+
$orderTimeTableName = (new ClassesSpec)->getWithAlisaName();
//修改
if($row){
- $this->specupdateCheck($row->id,$params,$row);
+ //修复旧数据时间戳
+ $row["start_time"]= strtotime(date("Y-m-d H:i",$row["start_time"]));
+ $row["end_time"]= strtotime(date("Y-m-d H:i",$row["end_time"]));
+
+ $this->updateCheck($row->id,$params,$row);
//规格名字不能一样(同课程下)
$spec_name = $params["name"];
diff --git a/application/manystore/controller/school/classes/ClassesLib.php b/application/manystore/controller/school/classes/ClassesLib.php
index 0b24f3c..aecaa8f 100644
--- a/application/manystore/controller/school/classes/ClassesLib.php
+++ b/application/manystore/controller/school/classes/ClassesLib.php
@@ -297,8 +297,16 @@ class ClassesLib extends ManystoreBase
$this->model->validateFailException(true)->validate($validate);
}
$this->update_check($params,$row=null);
+ $spec = $params["spec"];
+ unset($params["spec"]);
$result = $this->model->allowField(true)->save($params);
\app\common\model\school\classes\ClassesLib::add_virtual_init($this->model["id"]);
+ //添加课程规格
+ foreach ($spec as $k=>$v){
+ $v["classes_lib_id"] = $this->model["id"];
+ \app\common\model\school\classes\ClassesSpec::create($v);
+ }
+
$this->update_classes($this->model["id"]);
if($this->have_auth){
//调用通过事件
@@ -422,9 +430,30 @@ class ClassesLib extends ManystoreBase
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException(true)->validate($validate);
}
+
$this->update_check($params,$row);
+ $spec = $params["spec"] ?? [];//$params["delete_spec_ids"]
+ $delete_spec_ids = $params["delete_spec_ids"] ?? [];
+ unset($params["spec"]);
+ unset($params["delete_spec_ids"]);
+
$result = $row->allowField(true)->save($params);
+
+ foreach ($spec as $k=>$v){
+ $v["classes_lib_id"] = $row["id"];
+ //有id更新,否则新增
+ if(isset($v["id"]) && $v["id"]){
+ \app\common\model\school\classes\ClassesSpec::update((new \app\common\model\school\classes\ClassesSpec)->checkAssemblyParameters($v));
+ }else{
+ \app\common\model\school\classes\ClassesSpec::create((new \app\common\model\school\classes\ClassesSpec)->checkAssemblyParameters($v));
+ }
+ }
+ //删除规格
+ foreach ($delete_spec_ids as $k=>$delete_spec){
+ $delete_spec->delete();
+ }
+
$this->update_classes($row["id"]);
if($this->have_auth){
@@ -454,6 +483,12 @@ class ClassesLib extends ManystoreBase
}
$this->error(__('Parameter %s can not be empty', ''));
}
+
+ $spec = \app\common\model\school\classes\ClassesSpec::where("classes_lib_id",$row["id"])->field("id,classes_lib_id,name,start_time,end_time,limit_num,status,weigh")->order('weigh desc,id desc')->select();
+ foreach ($spec as $k=>&$v){
+ $v["time"] = date("Y/m/d H:i",$v["start_time"])." - ".date("Y/m/d H:i",$v["end_time"]);
+ }
+ $row["spec"] = json_encode($spec, JSON_UNESCAPED_UNICODE);//不转义任何字符串
$this->view->assign("row", $row);
return $this->view->fetch();
}
diff --git a/application/manystore/controller/school/classes/ClassesSpec.php b/application/manystore/controller/school/classes/ClassesSpec.php
index 66b9402..4795e0a 100644
--- a/application/manystore/controller/school/classes/ClassesSpec.php
+++ b/application/manystore/controller/school/classes/ClassesSpec.php
@@ -135,16 +135,28 @@ class ClassesSpec extends ManystoreBase
try {
- (new \app\common\model\school\classes\ClassesSpec)->specCheck($params,SHOP_ID,$row);
+
+ $classesLib = new \app\common\model\school\classes\ClassesSpec();
+ $classesLib->no_auth_fields = $this->no_auth_fields;
+ $classesLib->need_auth = $this->need_auth;
+ $classesLib->have_auth = $this->have_auth;
+ $classesLib->specCheck($params,SHOP_ID,$row);
+ $this->need_auth = $classesLib->need_auth;
+ $this->have_auth = $classesLib->have_auth;
+
+ //修改
+ if($row){
+ $classesLib->updateCheck($row->id,$params,$row);
+ }else{
+
+ }
+
+// (new \app\common\model\school\classes\ClassesSpec)->specCheck($params,SHOP_ID,$row);
}catch (\Exception $e){
$this->error($e->getMessage());
}
- //修改
- if($row){
- $this->updateCheck($row->id,$params,$row);
- }else{
- }
+
}
diff --git a/application/manystore/view/school/classes/classes_lib/addnew.html b/application/manystore/view/school/classes/classes_lib/addnew.html
index 37c9603..341befd 100644
--- a/application/manystore/view/school/classes/classes_lib/addnew.html
+++ b/application/manystore/view/school/classes/classes_lib/addnew.html
@@ -146,9 +146,9 @@
+