站内信模板化
This commit is contained in:
		
							parent
							
								
									f9222e1b7f
								
							
						
					
					
						commit
						66cf670643
					
				| @ -5,6 +5,7 @@ namespace app\admin\controller\auth; | ||||
| use app\admin\model\AuthGroup; | ||||
| use app\admin\model\AuthGroupAccess; | ||||
| use app\common\controller\Backend; | ||||
| use app\common\model\dyqc\ManystoreShop; | ||||
| use fast\Random; | ||||
| use fast\Tree; | ||||
| use think\Db; | ||||
| @ -298,4 +299,34 @@ class Admin extends Backend | ||||
|         $this->dataLimitField = 'id'; | ||||
|         return parent::selectpage(); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     /** | ||||
|      * 后台生成默认机构 | ||||
|      * @return string | ||||
|      * @throws \think\Exception | ||||
|      * @throws \think\db\exception\BindParamException | ||||
|      * @throws \think\exception\DbException | ||||
|      * @throws \think\exception\PDOException | ||||
|      */ | ||||
|     public function createshop($ids = ''){ | ||||
|         $param = $this->request->param(); | ||||
|         if($this->request->isPost()){ | ||||
|             try{ | ||||
|                 if(isset($param['ids']))$ids = $param['ids']; | ||||
|                 //设置模拟资格
 | ||||
|                 $model = new ManystoreShop; | ||||
|                 $model->adminshopadd($ids,true); | ||||
| 
 | ||||
| 
 | ||||
|             }catch (\Exception $e){ | ||||
|                 $this->error($e->getMessage()); | ||||
|             } | ||||
|             $this->success('生成机构成功!'); | ||||
|         } | ||||
|         $row = $this->model->get($ids); | ||||
|         $this->view->assign('vo', $row); | ||||
|         return $this->view->fetch(); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -226,4 +226,32 @@ class ManystoreShop extends Backend | ||||
|         return json(['list' => $list, 'total' => $total]); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     /** | ||||
|      * 跳转链接 | ||||
|      * @return string | ||||
|      * @throws \think\Exception | ||||
|      * @throws \think\db\exception\BindParamException | ||||
|      * @throws \think\exception\DbException | ||||
|      * @throws \think\exception\PDOException | ||||
|      */ | ||||
|     public function url($ids = ''){ | ||||
|         $param = $this->request->param(); | ||||
|         if($this->request->isPost()){ | ||||
|             try{ | ||||
|                 if(isset($param['ids']))$ids = $param['ids']; | ||||
|                 //设置模拟资格
 | ||||
|               $url = \app\common\model\dyqc\ManystoreShop::getPath($ids); | ||||
| 
 | ||||
|             }catch (\Exception $e){ | ||||
|                 $this->error($e->getMessage()); | ||||
|             } | ||||
|             $this->success($url); | ||||
|         } | ||||
|         $row = $this->model->get($ids); | ||||
|         $this->view->assign('vo', $row); | ||||
|         return $this->view->fetch(); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -8,6 +8,7 @@ use app\admin\model\school\classes\Teacher; | ||||
| use app\admin\model\school\classes\Verification; | ||||
| use app\admin\model\User; | ||||
| use app\common\model\manystore\Shop; | ||||
| use app\common\model\school\classes\activity\Activity; | ||||
| use app\common\model\school\classes\Evaluate; | ||||
| use app\common\model\school\classes\Order; | ||||
| 
 | ||||
| @ -308,6 +309,15 @@ class Index extends Backend | ||||
|         //有课程不允许删
 | ||||
|         $classesLib = ClassesLib::where("manystore_id",$id)->find(); | ||||
|         if($classesLib)throw new \Exception("请先删除课程后再删除机构!"); | ||||
| 
 | ||||
| 
 | ||||
|         // 课程存在售后订单则不允许操作
 | ||||
|         $order = \app\common\model\school\classes\activity\order\Order::where("manystore_id",$id)->where("status","not in","-3,6,9")->find(); | ||||
|         if($order)throw new \Exception("存在正在使用中的活动订单报名学员,无法继续操作!"); | ||||
| 
 | ||||
|         $activity = Activity::where("manystore_id",$id)->find(); | ||||
|         if($activity)throw new \Exception("请先删除活动后再删除机构!"); | ||||
| 
 | ||||
| //        //有老师不允许删
 | ||||
| //        $teacher = Teacher::where("manystore_id",$id)->find();
 | ||||
| //        if($teacher)throw new \Exception("请先删除老师后再删除机构!");
 | ||||
| @ -640,6 +650,26 @@ class Index extends Backend | ||||
|                    } | ||||
|                     $lib->delete(); | ||||
|                 } | ||||
|                 //删除活动及其规格
 | ||||
|                 $activitys = \app\common\model\school\classes\activity\Activity::where(array('shop_id'=>$row['shop_id']))->select(); | ||||
|                 foreach ($activitys as $activity){ | ||||
|                     $specs = $activity->items; | ||||
|                     foreach ($specs as $spec){ | ||||
|                         $spec->delete(); | ||||
|                     } | ||||
|                     $activity->delete(); | ||||
|                 } | ||||
|                 $activityauths = \app\common\model\school\classes\activity\ActivityAuth::where(array('shop_id'=>$row['shop_id']))->select(); | ||||
|                 foreach ($activityauths as $activity){ | ||||
|                     $specs = $activity->itemauths; | ||||
|                     foreach ($specs as $spec){ | ||||
|                         $spec->delete(); | ||||
|                     } | ||||
|                     $activity->delete(); | ||||
|                 } | ||||
| 
 | ||||
|                 Admin::where(array('admin_shop_id'=>$row['shop_id']))->update(['admin_shop_id'=>0]); | ||||
| 
 | ||||
|                 Evaluate::where(array('shop_id'=>$row['shop_id']))->delete(); | ||||
|                 if(!$result){ | ||||
|                     exception('商家信息删除失败'); | ||||
| @ -674,4 +704,31 @@ class Index extends Backend | ||||
|         $this->dataLimitField = 'id'; | ||||
|         return parent::selectpage(); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     /** | ||||
|      * 跳转链接 | ||||
|      * @return string | ||||
|      * @throws \think\Exception | ||||
|      * @throws \think\db\exception\BindParamException | ||||
|      * @throws \think\exception\DbException | ||||
|      * @throws \think\exception\PDOException | ||||
|      */ | ||||
|     public function url($ids = ''){ | ||||
|         $param = $this->request->param(); | ||||
|         if($this->request->isPost()){ | ||||
|             try{ | ||||
|                 if(isset($param['ids']))$ids = $param['ids']; | ||||
|                 //设置模拟资格
 | ||||
|                 $url =  \app\common\model\dyqc\ManystoreShop::getPath($ids); | ||||
| 
 | ||||
|             }catch (\Exception $e){ | ||||
|                 $this->error($e->getMessage()); | ||||
|             } | ||||
|             $this->success($url); | ||||
|         } | ||||
|         $row = $this->model->get($ids); | ||||
|         $this->view->assign('vo', $row); | ||||
|         return $this->view->fetch(); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -1053,4 +1053,31 @@ class ClassesLib extends Backend | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     /** | ||||
|      * 跳转链接 | ||||
|      * @return string | ||||
|      * @throws \think\Exception | ||||
|      * @throws \think\db\exception\BindParamException | ||||
|      * @throws \think\exception\DbException | ||||
|      * @throws \think\exception\PDOException | ||||
|      */ | ||||
|     public function url($ids = ''){ | ||||
|         $param = $this->request->param(); | ||||
|         if($this->request->isPost()){ | ||||
|             try{ | ||||
|                 if(isset($param['ids']))$ids = $param['ids']; | ||||
|                 //设置模拟资格
 | ||||
|                 $url =  \app\common\model\school\classes\ClassesLib::getPath($ids); | ||||
| 
 | ||||
|             }catch (\Exception $e){ | ||||
|                 $this->error($e->getMessage()); | ||||
|             } | ||||
|             $this->success($url); | ||||
|         } | ||||
|         $row = $this->model->get($ids); | ||||
|         $this->view->assign('vo', $row); | ||||
|         return $this->view->fetch(); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -314,4 +314,32 @@ class Teacher extends Backend | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     /** | ||||
|      * 跳转链接 | ||||
|      * @return string | ||||
|      * @throws \think\Exception | ||||
|      * @throws \think\db\exception\BindParamException | ||||
|      * @throws \think\exception\DbException | ||||
|      * @throws \think\exception\PDOException | ||||
|      */ | ||||
|     public function url($ids = ''){ | ||||
|         $param = $this->request->param(); | ||||
|         if($this->request->isPost()){ | ||||
|             try{ | ||||
|                 if(isset($param['ids']))$ids = $param['ids']; | ||||
|                 //设置模拟资格
 | ||||
|                 $url =  \app\common\model\school\classes\Teacher::getPath($ids); | ||||
| 
 | ||||
|             }catch (\Exception $e){ | ||||
|                 $this->error($e->getMessage()); | ||||
|             } | ||||
|             $this->success($url); | ||||
|         } | ||||
|         $row = $this->model->get($ids); | ||||
|         $this->view->assign('vo', $row); | ||||
|         return $this->view->fetch(); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -429,4 +429,31 @@ class Activity extends Backend | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     /** | ||||
|      * 跳转链接 | ||||
|      * @return string | ||||
|      * @throws \think\Exception | ||||
|      * @throws \think\db\exception\BindParamException | ||||
|      * @throws \think\exception\DbException | ||||
|      * @throws \think\exception\PDOException | ||||
|      */ | ||||
|     public function url($ids = ''){ | ||||
|         $param = $this->request->param(); | ||||
|         if($this->request->isPost()){ | ||||
|             try{ | ||||
|                 if(isset($param['ids']))$ids = $param['ids']; | ||||
|                 //设置模拟资格
 | ||||
|                 $url =  \app\common\model\school\classes\activity\Activity::getPath($ids); | ||||
| 
 | ||||
|             }catch (\Exception $e){ | ||||
|                 $this->error($e->getMessage()); | ||||
|             } | ||||
|             $this->success($url); | ||||
|         } | ||||
|         $row = $this->model->get($ids); | ||||
|         $this->view->assign('vo', $row); | ||||
|         return $this->view->fetch(); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -134,7 +134,7 @@ class Order extends Backend | ||||
|                 $model = (new \app\common\model\school\classes\activity\order\Order); | ||||
|                 $model->examine($params["id"],$auth_status,$reason,0,true,'admin',$this->auth->id,true); | ||||
| 
 | ||||
|             }catch (\Exception $e){ | ||||
|             }catch (\Throwable $e){ | ||||
|                 $this->error($e->getMessage()); | ||||
|             } | ||||
| 
 | ||||
|  | ||||
| @ -13,6 +13,12 @@ | ||||
|         a { | ||||
|             color: #444; | ||||
|         } | ||||
|         .container{ | ||||
|                 margin-right: inherit; | ||||
|     margin-left: auto; | ||||
|     padding-left: 15px; | ||||
|     padding-right: 15px; | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         .login-screen { | ||||
| @ -59,6 +65,7 @@ | ||||
|         } | ||||
| 
 | ||||
|         .login-form { | ||||
|             margin: 250px 30px; | ||||
|             padding: 40px 30px; | ||||
|             position: relative; | ||||
|             z-index: 99; | ||||
| @ -81,7 +88,9 @@ | ||||
|     {if $background} | ||||
|         <style type="text/css"> | ||||
|             body{ | ||||
|                 background-image: url('{$background}'); | ||||
|                 /*background-image: url('{$background}');*/ | ||||
|                 /*background-image: url('__CDN__/uniapp_image/putLogin.png');*/ | ||||
|                 background: url('__CDN__/uniapp_image/login.png') no-repeat left center fixed; | ||||
|             } | ||||
|         </style> | ||||
|     {/if} | ||||
| @ -93,10 +102,10 @@ | ||||
|         <div class="login-screen"> | ||||
|             <div class="well"> | ||||
|                 <div class="login-head"> | ||||
|                     <img src="__CDN__/assets/img/login-head.png" style="width:100%;"/> | ||||
| <!--                    <img src="__CDN__/assets/img/login-head.png" style="width:100%;"/>--> | ||||
|                 </div> | ||||
|                 <div class="login-form"> | ||||
|                     <img id="profile-img" class="profile-img-card" src="__CDN__/assets/img/avatar.png"/> | ||||
| <!--                    <img id="profile-img" class="profile-img-card" src="__CDN__/assets/img/avatar.png"/>--> | ||||
|                     <p id="profile-name" class="profile-name-card"></p> | ||||
| 
 | ||||
|                     <form action="" method="post" id="login-form"> | ||||
|  | ||||
| @ -96,6 +96,7 @@ class Index extends Api | ||||
|             "site_version"=>''.config('site.version'), | ||||
|             "site_city"=> Virtual::getNowCity(), | ||||
|             "site_timezone"=>config('site.timezone'), | ||||
|             "wx_miniapp_version"=>config("site.wx_miniapp_version"), | ||||
|         ]; | ||||
|         $customer_service = [ | ||||
|             "image"=>cdnurl(config('site.customer_service_image'),true), | ||||
|  | ||||
| @ -5,6 +5,7 @@ namespace app\common\library; | ||||
| use app\common\model\school\Area; | ||||
| use app\common\model\school\classes\VirtualHead; | ||||
| use app\common\model\school\classes\VirtualUser; | ||||
| use bw\Common; | ||||
| 
 | ||||
| /** | ||||
|  *  虚拟数据工具类 | ||||
| @ -40,7 +41,8 @@ class Virtual | ||||
|                 "head_image"=>$head, | ||||
|                 "time"=>$r, | ||||
|                 "jointype" => "1", | ||||
|                 "havetype" => "".($k % 2) | ||||
| //                "havetype" => "".($k % 2)
 | ||||
|                 "havetype" => "0" //只要非已报名数据
 | ||||
|             ]; | ||||
|         } | ||||
| 
 | ||||
| @ -159,5 +161,15 @@ class Virtual | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     public static function getPath($key,$params=[],$expression = '{{KEYWORD}}'){ | ||||
|        $wx_miniapp_path = config("site.wx_miniapp_path"); | ||||
|        if(!$wx_miniapp_path) throw new \Exception("请先配置小程序路径"); | ||||
|        if(!isset($wx_miniapp_path[$key])) throw new \Exception("请先配置小程序路径"); | ||||
|        $path = $wx_miniapp_path[$key]; | ||||
|        // 参数替换
 | ||||
|        $template = Common::parsePrintTemplateString($path,$params,$expression); | ||||
|        return $template; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
| @ -1,7 +1,9 @@ | ||||
| <?php | ||||
| namespace app\common\listener\classeshourorder; | ||||
| use app\common\model\school\classes\hourorder\OrderLog; | ||||
| use app\common\model\school\classes\Teacher; | ||||
| use app\common\model\school\Message; | ||||
| use app\common\model\school\MessageConfig; | ||||
| 
 | ||||
| class OrderHook | ||||
| { | ||||
| @ -21,11 +23,20 @@ class OrderHook | ||||
|     { | ||||
|         ["order"=>$order] = $params; | ||||
|         $detail = $order->detail; | ||||
|         $user = $order->user; | ||||
|         //查询老师信息和老师用户信息
 | ||||
|         $teacher = Teacher::where("id", $detail["teacher_id"])->find(); | ||||
|         $teacher_user = null; | ||||
|         if($teacher){ | ||||
|             $teacher_user = $teacher->user; | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         //记录订单日志
 | ||||
|         if($order["type"] == "1"){ | ||||
|             $desc = "{$detail["title"]}课程课时{$order["name"]}课程预约下单成功,等待机构老师审核"; | ||||
|             $desc = ""; | ||||
|         }else{ | ||||
|             $desc = "{$detail["title"]}课程课时{$order["name"]}预约机构老师代下单成功"; | ||||
|             $desc = "[机构老师代操作]"; | ||||
|         } | ||||
|         $title = "创建课时预约成功"; | ||||
|         $mini_type = "classes_auth"; | ||||
| @ -40,8 +51,45 @@ 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); | ||||
| 
 | ||||
| 
 | ||||
|         $param = [ | ||||
|             "title"=>$detail["title"], | ||||
|             "name" => $order["name"], | ||||
|             "order_no" => $order["order_no"], | ||||
|             "nickname" => $user["nickname"], | ||||
|             "realname" => $user["realname"], | ||||
|             "mobile" => $user["mobile"], | ||||
| //            "price" => $order["totalprice"],
 | ||||
|             "system"=>$desc, | ||||
|             "teacher_name"=> $teacher["name"] ?? "课程负责人", | ||||
|             "teacher_realname"=> $teacher_user["realname"] ?? "课程负责人真实姓名", | ||||
|             "teacher_nickname"=> $teacher_user["nickname"] ?? "课程负责人昵称", | ||||
|             "teacher_mobile"=> $teacher_user["mobile"] ?? "课程负责人电话", | ||||
|             "start_time" => date("Y-m-d H:i",$order["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
 | ||||
|             "end_time" =>   date("Y-m-d H:i",$order["end_time"]), | ||||
|             "address"=>$detail["address"]."(".$detail["address_detail"].")", | ||||
|         ]; | ||||
| 
 | ||||
|         //发给用户
 | ||||
|         (new MessageConfig) | ||||
|             ->setTemplate($params["event"]."_user") | ||||
|             ->setTemplateData($param) | ||||
|             ->setToUid($to_id) | ||||
|             ->setMessageStatus($status) | ||||
|             ->setMessageMiniType($mini_type) | ||||
|             ->setMessageParams($params) | ||||
|             ->sendMessage(); | ||||
| 
 | ||||
|         //发给老师
 | ||||
|         (new MessageConfig) | ||||
|             ->setTemplate($params["event"]."_teacher") | ||||
|             ->setTemplateData($param) | ||||
|             ->setToUid($detail["user_id"]) | ||||
|             ->setMessageStatus($status) | ||||
|             ->setMessageMiniType($mini_type) | ||||
|             ->setMessageParams($params) | ||||
|             ->sendMessage(); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| @ -51,11 +99,18 @@ class OrderHook | ||||
|     { | ||||
|         ['order' => $order,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params; | ||||
|         $detail = $order->detail; | ||||
|         $user = $order->user; | ||||
|         //查询老师信息和老师用户信息
 | ||||
|         $teacher = Teacher::where("id", $detail["teacher_id"])->find(); | ||||
|         $teacher_user = null; | ||||
|         if($teacher){ | ||||
|             $teacher_user = $teacher->user; | ||||
|         } | ||||
|         //插入订单取消日志
 | ||||
|         if(!$user_id ||$order["user_id"] !=$user_id ){ | ||||
|             $desc = "[员工操作]预约{$detail["title"]}课程订单规格已变更课时为{$order["name"]}"; | ||||
|             $desc = "[机构老师代操作]"; | ||||
|         }else{ | ||||
|             $desc = "预约{$detail["title"]}课程订单规格已变更课时为{$order["name"]}"; | ||||
|             $desc = ""; | ||||
|         } | ||||
| 
 | ||||
|         $title = "课时预约单更换课时"; | ||||
| @ -71,8 +126,35 @@ 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); | ||||
| 
 | ||||
| 
 | ||||
|         $param = [ | ||||
|             "title"=>$detail["title"], | ||||
|             "name" => $order["name"], | ||||
|             "order_no" => $order["order_no"], | ||||
|             "nickname" => $user["nickname"], | ||||
|             "realname" => $user["realname"], | ||||
|             "mobile" => $user["mobile"], | ||||
| //            "price" => $order["totalprice"],
 | ||||
|             "system"=>$desc, | ||||
|             "teacher_name"=> $teacher["name"] ?? "课程负责人", | ||||
|             "teacher_realname"=> $teacher_user["realname"] ?? "课程负责人真实姓名", | ||||
|             "teacher_nickname"=> $teacher_user["nickname"] ?? "课程负责人昵称", | ||||
|             "teacher_mobile"=> $teacher_user["mobile"] ?? "课程负责人电话", | ||||
|             "start_time" => date("Y-m-d H:i",$order["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
 | ||||
|             "end_time" =>   date("Y-m-d H:i",$order["end_time"]), | ||||
|             "address"=>$detail["address"]."(".$detail["address_detail"].")", | ||||
|         ]; | ||||
| 
 | ||||
|         //发给用户
 | ||||
|         (new MessageConfig) | ||||
|             ->setTemplate($params["event"]) | ||||
|             ->setTemplateData($param) | ||||
|             ->setToUid($to_id) | ||||
|             ->setMessageStatus($status) | ||||
|             ->setMessageMiniType($mini_type) | ||||
|             ->setMessageParams($params) | ||||
|             ->sendMessage(); | ||||
| 
 | ||||
| 
 | ||||
|     } | ||||
| @ -85,6 +167,13 @@ class OrderHook | ||||
|     { | ||||
|         ['order' => $order,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params; | ||||
|         $detail = $order->detail; | ||||
|         $user = $order->user; | ||||
|         //查询老师信息和老师用户信息
 | ||||
|         $teacher = Teacher::where("id", $detail["teacher_id"])->find(); | ||||
|         $teacher_user = null; | ||||
|         if($teacher){ | ||||
|             $teacher_user = $teacher->user; | ||||
|         } | ||||
|         //插入订单取消日志
 | ||||
|         if(!$user_id ||$order["user_id"] !=$user_id ){ | ||||
|             $pron = "[员工操作]"; | ||||
| @ -106,8 +195,37 @@ 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); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         $param = [ | ||||
|             "title"=>$detail["title"], | ||||
|             "name" => $order["name"], | ||||
|             "order_no" => $order["order_no"], | ||||
|             "nickname" => $user["nickname"], | ||||
|             "realname" => $user["realname"], | ||||
|             "mobile" => $user["mobile"], | ||||
| //            "price" => $order["totalprice"],
 | ||||
|             "system"=>$desc, | ||||
|             "teacher_name"=> $teacher["name"] ?? "课程负责人", | ||||
|             "teacher_realname"=> $teacher_user["realname"] ?? "课程负责人真实姓名", | ||||
|             "teacher_nickname"=> $teacher_user["nickname"] ?? "课程负责人昵称", | ||||
|             "teacher_mobile"=> $teacher_user["mobile"] ?? "课程负责人电话", | ||||
|             "start_time" => date("Y-m-d H:i",$order["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式
 | ||||
|             "end_time" =>   date("Y-m-d H:i",$order["end_time"]), | ||||
|             "address"=>$detail["address"]."(".$detail["address_detail"].")", | ||||
|         ]; | ||||
| 
 | ||||
|         //发给用户
 | ||||
|         (new MessageConfig) | ||||
|             ->setTemplate($params["event"]) | ||||
|             ->setTemplateData($param) | ||||
|             ->setToUid($to_id) | ||||
|             ->setMessageStatus($status) | ||||
|             ->setMessageMiniType($mini_type) | ||||
|             ->setMessageParams($params) | ||||
|             ->sendMessage(); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     // 订单审核失败后
 | ||||
|  | ||||
| @ -142,10 +142,11 @@ class OrderHook | ||||
|     { | ||||
|         ["order"=>$order] = $params; | ||||
|         $detail = $order->detail; | ||||
|         $user = $order->user; | ||||
| 
 | ||||
|         //记录订单日志
 | ||||
| 
 | ||||
|         $desc = "恭喜您!您的{$detail["title"]}课程完结啦"; | ||||
|         $desc = ""; | ||||
| 
 | ||||
|         $title = "课程完结撒花!"; | ||||
|         $mini_type = "order_notice"; | ||||
| @ -161,8 +162,26 @@ 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); | ||||
| 
 | ||||
| 
 | ||||
|         $param = [ | ||||
|             "system"=> $desc, | ||||
|             "title"=> $detail["title"], | ||||
|             "order_no" => $order["order_no"], | ||||
|             "nickname" => $user["nickname"], | ||||
|             "realname" => $user["realname"], | ||||
|             "mobile" => $user["mobile"], | ||||
|             "price" => $order["payprice"], | ||||
|         ]; | ||||
| 
 | ||||
|         (new MessageConfig) | ||||
|             ->setTemplate($params["event"]) | ||||
|             ->setTemplateData($param) | ||||
|             ->setToUid($to_id) | ||||
|             ->setMessageStatus($status) | ||||
|             ->setMessageMiniType($mini_type) | ||||
|             ->setMessageParams($params) | ||||
|             ->sendMessage(); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| @ -172,12 +191,12 @@ class OrderHook | ||||
|     public function classesOrderEvaluateAfter(&$params) | ||||
|     { | ||||
|         ['order' => $order,"classes_evaluate"=>$classes_evaluate,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params; | ||||
| 
 | ||||
|         $user = $order->user; | ||||
|         $detail = $order->detail; | ||||
|         if(!$user_id ||$order["user_id"] !=$user_id ){ | ||||
|             $desc = "[系统操作]课程{$detail["title"]}订单反馈成功"; | ||||
|             $desc = "[系统操作]"; | ||||
|         }else{ | ||||
|             $desc = "课程{$detail["title"]}订单反馈成功"; | ||||
|             $desc = ""; | ||||
|         } | ||||
| 
 | ||||
|         $title = "课程订单已反馈"; | ||||
| @ -193,10 +212,37 @@ 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); | ||||
| 
 | ||||
|         Evaluate::evaluateStatistics($classes_evaluate->id); | ||||
| 
 | ||||
|         $param = [ | ||||
|             "system"=> $desc, | ||||
|             "title"=> $detail["title"], | ||||
|             "order_no" => $order["order_no"], | ||||
|             "nickname" => $user["nickname"], | ||||
|             "realname" => $user["realname"], | ||||
|             "mobile" => $user["mobile"], | ||||
|             "price" => $order["payprice"], | ||||
|         ]; | ||||
|         //发给用户
 | ||||
|         (new MessageConfig) | ||||
|             ->setTemplate($params["event"]."_user") | ||||
|             ->setTemplateData($param) | ||||
|             ->setToUid($to_id) | ||||
|             ->setMessageStatus($status) | ||||
|             ->setMessageMiniType($mini_type) | ||||
|             ->setMessageParams($params) | ||||
|             ->sendMessage(); | ||||
| 
 | ||||
|         //发给老师
 | ||||
|         (new MessageConfig) | ||||
|             ->setTemplate($params["event"]."_teacher") | ||||
|             ->setTemplateData($param) | ||||
|             ->setToUid($detail["user_id"]) | ||||
|             ->setMessageStatus($status) | ||||
|             ->setMessageMiniType($mini_type) | ||||
|             ->setMessageParams($params) | ||||
|             ->sendMessage(); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| @ -206,12 +252,12 @@ class OrderHook | ||||
|     public function classesOrderEvaluateUpdateAfter(&$params) | ||||
|     { | ||||
|         ['order' => $order,"classes_evaluate"=>$classes_evaluate,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params; | ||||
| 
 | ||||
|         $user = $order->user; | ||||
|         $detail = $order->detail; | ||||
|         if(!$user_id ||$order["user_id"] !=$user_id ){ | ||||
|             $desc = "[系统操作]课程{$detail["title"]}订单反馈更新成功"; | ||||
|             $desc = "[系统操作]"; | ||||
|         }else{ | ||||
|             $desc = "课程{$detail["title"]}订单反馈更新成功"; | ||||
|             $desc = ""; | ||||
|         } | ||||
| 
 | ||||
|         $title = "课程订单已修改反馈"; | ||||
| @ -227,9 +273,39 @@ 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); | ||||
|         Evaluate::evaluateStatistics($classes_evaluate->id); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         $param = [ | ||||
|             "system"=> $desc, | ||||
|             "title"=> $detail["title"], | ||||
|             "order_no" => $order["order_no"], | ||||
|             "nickname" => $user["nickname"], | ||||
|             "realname" => $user["realname"], | ||||
|             "mobile" => $user["mobile"], | ||||
|             "price" => $order["payprice"], | ||||
|         ]; | ||||
|         //发给用户
 | ||||
|         (new MessageConfig) | ||||
|             ->setTemplate($params["event"]."_user") | ||||
|             ->setTemplateData($param) | ||||
|             ->setToUid($to_id) | ||||
|             ->setMessageStatus($status) | ||||
|             ->setMessageMiniType($mini_type) | ||||
|             ->setMessageParams($params) | ||||
|             ->sendMessage(); | ||||
| 
 | ||||
|         //发给老师
 | ||||
|         (new MessageConfig) | ||||
|             ->setTemplate($params["event"]."_teacher") | ||||
|             ->setTemplateData($param) | ||||
|             ->setToUid($detail["user_id"]) | ||||
|             ->setMessageStatus($status) | ||||
|             ->setMessageMiniType($mini_type) | ||||
|             ->setMessageParams($params) | ||||
|             ->sendMessage(); | ||||
| 
 | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -42,6 +42,21 @@ class ShopHook | ||||
|   \app\common\model\school\classes\ClassesLib::update_classes($classesLib["id"]); | ||||
|        } | ||||
| 
 | ||||
| 
 | ||||
|         $activitys = \app\common\model\school\classes\activity\Activity::where("shop_id",$shop["id"])->where("address_type","1")->select(); | ||||
|         foreach ($activitys as $activity){ | ||||
|             $activity["address_city"] = $shop["address_city"]; | ||||
|             $activity["province"] = $shop["province"]; | ||||
|             $activity["city"] = $shop["city"]; | ||||
|             $activity["district"] = $shop["district"]; | ||||
|             $activity["longitude"] = $shop["longitude"]; | ||||
|             $activity["latitude"] = $shop["latitude"]; | ||||
|             $activity["address"] = $shop["address"]; | ||||
|             $activity["address_detail"] = $shop["address_detail"]; | ||||
|             $activity->save(); | ||||
|             \app\common\model\school\classes\activity\Activity::update_classes($activity["id"]); | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -2,11 +2,14 @@ | ||||
| 
 | ||||
| namespace app\common\model\dyqc; | ||||
| 
 | ||||
| use app\admin\model\Admin; | ||||
| use app\common\library\Virtual; | ||||
| use app\common\model\BaseModel; | ||||
| use app\common\model\school\Area; | ||||
| use app\common\model\school\classes\ClassesLib; | ||||
| use app\common\model\school\classes\Teacher; | ||||
| use app\common\model\school\classes\Verification; | ||||
| use app\common\model\school\SearchCity; | ||||
| use app\common\model\User; | ||||
| use app\manystore\model\Manystore; | ||||
| use app\manystore\model\ManystoreAuthGroup; | ||||
| @ -801,7 +804,7 @@ public  function creatShop($type,$user_id,$params){ | ||||
|     $manystore_params["username"] = $params["tel"] ?: self::$pinyin->permalink($manystore_params["nickname"]); | ||||
|     $manystore_params["email"] = $manystore_params["username"] . "@xx.com"; | ||||
| 
 | ||||
|     $manystore_params['password'] = self::getDefaultPassword($type,$user_id,$params); | ||||
|     $manystore_params['password'] = $params['password'] ?? self::getDefaultPassword($type,$user_id,$params); | ||||
| 
 | ||||
|     $manystore_params['shop_id'] = $shop->id; | ||||
|     $manystore_params['salt'] = Random::alnum(); | ||||
| @ -810,9 +813,11 @@ public  function creatShop($type,$user_id,$params){ | ||||
| 
 | ||||
|     //如果用户存在头像取用户头像
 | ||||
|     if($user["avatar"]) $manystore_params['avatar'] = $user["avatar"]; | ||||
| 
 | ||||
|     $manystore_params['is_main'] = 1; | ||||
|     $manystore_params['status'] = "hidden"; | ||||
|     if(!isset($params['password'])){ | ||||
|         $manystore_params['status'] = "hidden"; | ||||
|     } | ||||
| 
 | ||||
|     $model = new Manystore(); | ||||
| 
 | ||||
|     $result = $model->allowField(true)->save($manystore_params); | ||||
| @ -1080,5 +1085,82 @@ public static function getAuthInfo($user_id){ | ||||
| //
 | ||||
| //  }
 | ||||
| 
 | ||||
|     public function adminshopadd($admin_id,$trans=false){ | ||||
|         $admin = Admin::where("id",$admin_id)->find(); | ||||
|         if(!$admin){ | ||||
|             throw new \Exception("管理员不存在"); | ||||
|         } | ||||
| //判断逻辑
 | ||||
|         if($trans){ | ||||
|             self::beginTrans(); | ||||
|         } | ||||
|         $res = true; | ||||
|         try{ | ||||
|             $shop =  $this->adminCreateShop($admin_id); | ||||
|             $admin["admin_shop_id"] = $shop["id"]; | ||||
|              $admin->save(); | ||||
|             if($trans){ | ||||
|                 self::commitTrans(); | ||||
|             } | ||||
|         }catch (\Exception $e){ | ||||
|             if($trans){ | ||||
|                 self::rollbackTrans(); | ||||
|             } | ||||
|             throw new \Exception($e->getMessage().$e->getFile().$e->getLine()); | ||||
|         } | ||||
|         return $res; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| //根据总管理员创建机构
 | ||||
| public function adminCreateShop($admin_id){ | ||||
|     $admin = Admin::where("id",$admin_id)->find(); | ||||
|     if(!$admin){ | ||||
|         throw new \Exception("管理员不存在"); | ||||
|     } | ||||
|     if(!$admin["mobile"]) throw new \Exception("管理员手机号不存在"); | ||||
|     if(!$admin["nickname"]) throw new \Exception("管理员昵称不存在"); | ||||
|     if(!$admin['area_json']) throw new \Exception("管理员限定区域不存在"); | ||||
|     $admin['area_json'] = explode(",",$admin['area_json']); | ||||
|     $searchCity = SearchCity::where( "id",$admin['area_json'][0] ?? 0)->find(); | ||||
|     if(!$searchCity) throw new \Exception("管理员限定区域不存在"); | ||||
|     //根据手机号生成机构用户
 | ||||
|     $user = \app\common\model\User::where("mobile",$admin["mobile"])->find(); | ||||
|     $people_name = $admin["nickname"] ."专属机构"; | ||||
|     $people_mobile = $admin["mobile"]; | ||||
|     //检测更新教练下单学员账号创建状态 2022/8/27 new
 | ||||
|     if(!$user)$user = (new \app\common\model\User)->addUserByMobile($people_mobile,$people_name); | ||||
|     $type = '2'; | ||||
|     $shop = self::where( "user_id",$user["id"])->find(); | ||||
|     $params = []; | ||||
|     $params["user_id"] = $user["id"]; | ||||
|     $params["name"] = $people_name; | ||||
|     $params["logo"] = config("site.shop_default_image"); | ||||
|     $params["image"] = $admin["avatar"] ?:  config("site.shop_default_timage"); | ||||
|     $params["images"] = $admin["avatar"] ?:  config("site.shop_default_images"); | ||||
|     $params["address_city"] = $searchCity["address_city"]; | ||||
|     $params["province"] = $searchCity["province"]; | ||||
|     $params["city"] = $searchCity["city"]; | ||||
|     $params["district"] = $searchCity["district"]; | ||||
|     $params["address"] = "无"; | ||||
|     $params["address_detail"] = "无"; | ||||
|     $params["tel"] = $people_mobile; | ||||
|     $params["content"] = "无"; | ||||
|     $params["desc"] = "总后台创建账号时自动生成"; | ||||
|     $params["status"]= 1; | ||||
|     $params["auth_time"] = time(); | ||||
|     $params["admin_id"] = $admin_id; | ||||
|     $params["password"]  = "a123456"; | ||||
| 
 | ||||
|     if( !$shop) $shop = $this->creatShop($type,$user["id"],$params); | ||||
| 
 | ||||
|     return $shop; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|     public static function getPath($id){ | ||||
|         return Virtual::getPath("shop",["shop_id"=>$id]); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -38,6 +38,8 @@ class MessageConfig extends Model | ||||
|     protected $messageStatus = "system"; | ||||
|     protected $messageParams = []; | ||||
| 
 | ||||
|     protected $message_title = ""; | ||||
| 
 | ||||
|     //创建上面变量的get和set方法
 | ||||
|     public function setMessageMiniType($value){ | ||||
|         $this->messageMiniType = $value; | ||||
| @ -190,6 +192,9 @@ class MessageConfig extends Model | ||||
|     public function getMessageContent(){ | ||||
|         return $this->templateString; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     public function getTemplate(){ | ||||
|         return $this->messageTemplate; | ||||
|     } | ||||
| @ -201,6 +206,13 @@ class MessageConfig extends Model | ||||
|         $this->toUid = $uid; | ||||
|         return $this; | ||||
|     } | ||||
|     public function getMessageTitle(){ | ||||
|         return $this->message_title; | ||||
|     } | ||||
|     public function setMessageTitle($title){ | ||||
|         $this->message_title = $title; | ||||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| @ -212,6 +224,13 @@ class MessageConfig extends Model | ||||
|         $template_content = $template['selfmail_template_text']; | ||||
|         //解析获取文本内容
 | ||||
|         $this->templateString = Common::parsePrintTemplateString($template_content,$this->templateData,$expression); | ||||
| 
 | ||||
| 
 | ||||
|         $message_title = $template['selfmail_title']; | ||||
|         //解析获取文本内容
 | ||||
|         $this->message_title = Common::parsePrintTemplateString($message_title,$this->templateData,$expression); | ||||
| 
 | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
| 
 | ||||
| @ -223,7 +242,7 @@ class MessageConfig extends Model | ||||
|         if($template['selfmail'] == '1'){ | ||||
|             if(!$this->toUid) throw new \Exception("发送对象不能为空"); | ||||
|             $message_content = $this->getMessageContent(); | ||||
|             $message_title = $template['selfmail_title']; | ||||
|             $message_title =  $this->getMessageTitle(); | ||||
|             if(!$message_content || !$message_title)return false; | ||||
|             Message::$event_name = $template["event"]; | ||||
|             Message::send($message_title,$message_content,$this->getMessageMiniType(),$this->toUid,$this->messageToType,$this->messageStatus,$this->messagePlatform,$this->messageParams,$this->messageOperId, $this->messageOperType); | ||||
|  | ||||
| @ -1399,13 +1399,18 @@ $user_unpaid_order = $user_paid_order =null; | ||||
|              //数组倒过来
 | ||||
|              $params["spec"] = array_reverse($params["spec"]); | ||||
|              $insert_spec = []; | ||||
|              $need_up = false; | ||||
|               foreach ($params["spec"] as $k=>&$v){ | ||||
|                     $v["weigh"] = $k + 1; | ||||
|                    if(!empty($v["id"]))$insert_spec[] = $v["id"]; | ||||
|                   if($v["status"] == '1'){ | ||||
|                       $need_up = true; | ||||
|                   } | ||||
|               } | ||||
|               if($insert_spec && $row){ | ||||
|                  $params["delete_spec_ids"] = ClassesSpec::where("classes_lib_id",$row->id)->where("id","not in",$insert_spec)->column("id"); | ||||
|               } | ||||
|              if(!$need_up)throw new \Exception("新添加的课程请先至少添加一个上架的课时规格后再上架!"); | ||||
|          } | ||||
| 
 | ||||
|          //存在需要删除的规格则判断规格是否能删除
 | ||||
| @ -1422,8 +1427,8 @@ $user_unpaid_order = $user_paid_order =null; | ||||
|         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("新添加的课程请先至少添加一个课时规格后再上架!"); | ||||
|             $check_spec = \app\common\model\school\classes\ClassesSpec::where("classes_lib_id",$row->id)->where("status",'1')->count(); | ||||
|             if(!$check_spec)throw new \Exception("新添加的课程请先至少添加一个上架的课时规格后再上架!"); | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| @ -1877,4 +1882,10 @@ $user_unpaid_order = $user_paid_order =null; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     public static function getPath($id){ | ||||
|         return Virtual::getPath("classes",["classes_id"=>$id]); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
| 
 | ||||
| namespace app\common\model\school\classes; | ||||
| 
 | ||||
| use app\common\library\Virtual; | ||||
| use app\common\model\BaseModel; | ||||
| use think\Model; | ||||
| use traits\model\SoftDelete; | ||||
| @ -162,5 +163,8 @@ class Teacher extends BaseModel | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     public static function getPath($id){ | ||||
|         return Virtual::getPath("teacher",["teacher_id"=>$id]); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -3,6 +3,7 @@ | ||||
| namespace app\common\model\school\classes\activity; | ||||
| 
 | ||||
| use app\admin\model\manystore\Shop; | ||||
| use app\common\library\Virtual; | ||||
| use app\common\model\manystore\UserAuth; | ||||
| use app\common\model\school\classes\activity\order\Order; | ||||
| use app\common\model\BaseModel; | ||||
| @ -647,13 +648,19 @@ class Activity extends BaseModel | ||||
|             //数组倒过来
 | ||||
|             $params["item_json"] = array_reverse($params["item_json"]); | ||||
|             $insert_spec = []; | ||||
|             $need_up = false; | ||||
|             foreach ($params["item_json"] as $k=>&$v){ | ||||
|                 $v["weigh"] = $k + 1; | ||||
|                 if(!empty($v["id"]))$insert_spec[] = $v["id"]; | ||||
|                 if($v["status"] == '1'){ | ||||
|                     $need_up = true; | ||||
|                 } | ||||
| 
 | ||||
|             } | ||||
|             if($insert_spec && $row){ | ||||
|                 $params["delete_spec_ids"] = ActivityItem::where("classes_activity_id",$row->id)->where("id","not in",$insert_spec)->column("id"); | ||||
|             } | ||||
|             if(!$need_up)throw new \Exception("新添加的活动请先至少添加一个活动规格后再上架!"); | ||||
|         } | ||||
| 
 | ||||
|         //存在需要删除的规格则判断规格是否能删除
 | ||||
| @ -670,8 +677,8 @@ class Activity extends BaseModel | ||||
|         if(empty($params["item_json"])){ | ||||
|             if(!$row)throw new \Exception("新添加的活动请先至少添加一个活动规格后再上架!"); | ||||
|             //判断是否拥有课时规格,没有则无法上架
 | ||||
|             $check_spec = ActivityItem::where("classes_activity_id",$row->id)->count(); | ||||
|             if(!$check_spec)throw new \Exception("新添加的活动请先至少添加一个活动规格后再上架!"); | ||||
|             $check_spec = ActivityItem::where("classes_activity_id",$row->id)->where("status",'1')->count(); | ||||
|             if(!$check_spec)throw new \Exception("新添加的活动请先至少添加一个上架的活动规格后再上架!"); | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| @ -1588,5 +1595,8 @@ class Activity extends BaseModel | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     public static function getPath($id){ | ||||
|        return Virtual::getPath("activity",["activity_id"=>$id]); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -773,7 +773,7 @@ class Order extends BaseModel | ||||
|             ->where('status',"not in",["-3","6"]) | ||||
|             ->where('user_id',$user_id) | ||||
|             ->find(); | ||||
|         if($order_info) throw new \Exception("该活动规格已预约或已上过,请勿重复预约!"); | ||||
|         if($order_info && $check) throw new \Exception("该活动规格已预约或已上过,请勿重复预约!"); | ||||
| 
 | ||||
|         //新增或更换课时时判断
 | ||||
|         //是否达成限制人数
 | ||||
| @ -802,7 +802,7 @@ class Order extends BaseModel | ||||
|             throw new \Exception("该课程活动信息缺失!"); | ||||
|         } | ||||
| 
 | ||||
|         if($classes_lib_spec_info["feel"] == '1'){ | ||||
|         if($classes_lib_spec_info["feel"] == '1' && $check){ | ||||
|             //免费课开始和结束时间有交叠无法下预约
 | ||||
|             if(!config("site.free_time_activity_check")){ | ||||
|                 //如果是免费课
 | ||||
| @ -829,7 +829,7 @@ class Order extends BaseModel | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         if(!config("site.all_time_activity_check")){ | ||||
|         if(!config("site.all_time_activity_check") && $check){ | ||||
|             //判断时间是否有交叠
 | ||||
|             $start_time = $lib['start_time']; | ||||
|             $end_time = $lib['end_time']; | ||||
| @ -1520,6 +1520,7 @@ class Order extends BaseModel | ||||
|         if($trans){ | ||||
|             self::beginTrans(); | ||||
|         } | ||||
|         $return = false; | ||||
|         $res = true; | ||||
|         try{ | ||||
|             //事务逻辑
 | ||||
| @ -1559,16 +1560,16 @@ class Order extends BaseModel | ||||
|                 }else{ | ||||
|                    //调用退款发起
 | ||||
|                     //更新订单状态
 | ||||
|                     $order = self::updateExamineFailSettlement($order,$reason,$user_id ?: $oper_id,$oper_type); | ||||
|                     $order = self::updateExamineFailSettlement($order['order_no'],$reason,$user_id ?: $oper_id,$oper_type); | ||||
| 
 | ||||
|                     //审核失败逻辑
 | ||||
|                     OrderLog::log($order['id'],$pron."课程活动单审核不通过,原因;{$reason},该活动单将自动退款以便重新下单",$oper_type ?: 'user', $oper_id ?: $order['user_id']); | ||||
|                     //调用订单事件
 | ||||
|                     $data = ['order' => $order,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id]; | ||||
|                     \think\Hook::listen('classes_activity_order_auth_fail_after', $data); | ||||
| 
 | ||||
| 
 | ||||
|                     self::orderRefund($order,$order['sub_refundprice'],$oper_type,$oper_id,$trans=false,$admin=false); | ||||
|                    $return = true; | ||||
| //                    throw new \Exception("测试错误!".$order["status"]);
 | ||||
| //                     self::orderRefund($order['order_no'],$order['sub_refundprice'],$oper_type,$oper_id,$trans=false,$admin=false);
 | ||||
|                 } | ||||
| 
 | ||||
|             } | ||||
| @ -1579,12 +1580,15 @@ class Order extends BaseModel | ||||
|             if($trans){ | ||||
|                 self::commitTrans(); | ||||
|             } | ||||
|         }catch (\Exception $e){ | ||||
|         }catch (\Throwable $e){ | ||||
|             if($trans){ | ||||
|                 self::rollbackTrans(); | ||||
|             } | ||||
|             throw new \Exception($e->getMessage()); | ||||
|             throw new \Exception($e->getMessage().$e->getFile().$e->getLine()); | ||||
|         } | ||||
| 
 | ||||
|         if($return)self::orderRefund($order['order_no'],$order['sub_refundprice'],$oper_type,$oper_id,$trans=false,$admin=false); | ||||
| 
 | ||||
|         return $order; | ||||
|     } | ||||
| 
 | ||||
| @ -1615,6 +1619,9 @@ class Order extends BaseModel | ||||
|             //事务逻辑
 | ||||
|             switch ($order['pay_type']) { | ||||
|                 case "wechat": //微信退款
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|                     self::wechatRefund($order,$refund_money,$oper_type,$oper_id); | ||||
|                     break; | ||||
| //                case "alipay": //支付宝退款
 | ||||
| @ -1692,7 +1699,7 @@ class Order extends BaseModel | ||||
|             $config['notify_url'] = $notify_url; | ||||
|             $pay = Pay::wechat($config); | ||||
| 
 | ||||
| 
 | ||||
| //            throw new \Exception($trans."111测试错误!".$order["status"]);
 | ||||
|             $result = $pay->refund($order_data); | ||||
| 
 | ||||
|             \think\Log::write('refund-result' . json_encode($result)); | ||||
| @ -1747,7 +1754,7 @@ class Order extends BaseModel | ||||
|         if(is_string($order))$order = self::getHaveRefundOrder($order); | ||||
|         $order->before_status  = $order->status;//refund_status
 | ||||
|         $order->status = "6"; | ||||
|         $order->service_stauts = "6"; | ||||
|         $order->server_status = "6"; | ||||
|         $order->real_refundprice = bcadd($order->real_refundprice ?:'0',$order->sub_refundprice  ,2); | ||||
|         $order->sub_refundprice = 0; | ||||
|         $order->refundtime = time(); | ||||
| @ -1837,7 +1844,7 @@ class Order extends BaseModel | ||||
|             if($trans){ | ||||
|                 self::commitTrans(); | ||||
|             } | ||||
|         }catch (\Exception $e){ | ||||
|         }catch (\Throwable $e){ | ||||
|             if($trans){ | ||||
|                 self::rollbackTrans(); | ||||
|             } | ||||
|  | ||||
| @ -31,7 +31,7 @@ | ||||
|             box-shadow: 0 0 30px rgba(0, 0, 0, 0.1); | ||||
|             background: rgba(255, 255, 255, 1); | ||||
|             border: none; | ||||
|             overflow: hidden; | ||||
|             /*overflow: hidden;*/ | ||||
|             padding: 0; | ||||
|         } | ||||
| 
 | ||||
| @ -61,6 +61,7 @@ | ||||
|         } | ||||
| 
 | ||||
|         .login-form { | ||||
|             margin: 250px 30px; | ||||
|             padding: 40px 30px; | ||||
|             position: relative; | ||||
|             z-index: 99; | ||||
| @ -84,7 +85,8 @@ | ||||
|     <style type="text/css"> | ||||
|         body{ | ||||
|             /*background-image: url('{$background}');*/ | ||||
|             background: url('__CDN__/uniapp_image/login.png') no-repeat left center fixed; | ||||
|             background-image: url('__CDN__/uniapp_image/putLogin.png'); | ||||
|             /*background: url('__CDN__/uniapp_image/login.png') no-repeat left center fixed;*/ | ||||
|         } | ||||
|     </style> | ||||
|     {/if} | ||||
| @ -96,10 +98,10 @@ | ||||
|         <div class="login-screen"> | ||||
|             <div class="well"> | ||||
|                 <div class="login-head"> | ||||
|                     <img src="__CDN__/assets/img/login-head.png" style="width:100%;"/> | ||||
| <!--                    <img src="__CDN__/assets/img/login-head.png" style="width:100%;"/>--> | ||||
|                 </div> | ||||
|                 <div class="login-form"> | ||||
|                     <img id="profile-img" class="profile-img-card" src="__CDN__/assets/img/avatar.png"/> | ||||
| <!--                    <img id="profile-img" class="profile-img-card" src="__CDN__/assets/img/avatar.png"/>--> | ||||
|                     <p id="profile-name" class="profile-name-card"></p> | ||||
| 
 | ||||
|                     <form action="" method="post" id="login-form"> | ||||
|  | ||||
| @ -10,6 +10,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||||
|                     edit_url: 'auth/admin/edit', | ||||
|                     del_url: 'auth/admin/del', | ||||
|                     multi_url: 'auth/admin/multi', | ||||
|                     createshop_url: 'auth/admin/createshop', | ||||
|                 } | ||||
|             }); | ||||
| 
 | ||||
| @ -27,6 +28,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||||
|             // 初始化表格
 | ||||
|             table.bootstrapTable({ | ||||
|                 url: $.fn.bootstrapTable.defaults.extend.index_url, | ||||
|                 fixedColumns: true, | ||||
|                 fixedRightNumber: 1, | ||||
|                 columns: [ | ||||
|                     [ | ||||
|                         {field: 'state', checkbox: true, }, | ||||
| @ -42,12 +45,61 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||||
| 
 | ||||
|                         {field: 'status', title: __("Status"), searchList: {"normal":__('Normal'),"hidden":__('Hidden')}, formatter: Table.api.formatter.status}, | ||||
|                         {field: 'logintime', title: __('Login time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true}, | ||||
|                         {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: function (value, row, index) { | ||||
| 
 | ||||
|                         {field: 'oper', title: __('其他操作'), table: table , buttons: [ | ||||
|                                 {name: 'createshop', | ||||
|                                     text: '生成默认机构', | ||||
|                                     icon: 'fa fa-sign-in', | ||||
|                                     classname: 'btn btn-xs btn-warning btn-magic btn-ajax', | ||||
|                                     url: $.fn.bootstrapTable.defaults.extend.createshop_url, | ||||
|                                     confirm: '确认生成默认机构么,请确保账号有区域,昵称和手机号!生成后需自己去补全缺失的机构信息,默认密码为a123456', | ||||
|                                     success: function (data, ret) { | ||||
|                                         Layer.alert(ret.msg ); | ||||
|                                         $(".btn-refresh").trigger("click"); | ||||
|                                     }, | ||||
|                                     error: function (data, ret) { | ||||
|                                         Layer.alert(ret.msg); | ||||
|                                         return false; | ||||
|                                     }, | ||||
|                                     visible: function (row) { | ||||
|                                         //显示条件 只能待入住订单
 | ||||
|                                         if(!row.admin_shop_id){ | ||||
|                                             return true; | ||||
|                                         } | ||||
|                                         return false; | ||||
|                                     }}, | ||||
|                                 { | ||||
|                                     name: 'manystore', | ||||
|                                     text: __('我的默认机构'), | ||||
|                                     title: __('我的默认机构'), | ||||
|                                     classname: 'btn btn-dialog', | ||||
|                                     icon: 'fa fa-home', | ||||
|                                     dropdown : '更多', | ||||
|                                     url: manystore_url, | ||||
|                                     callback: function (data) { | ||||
| 
 | ||||
|                                     }, | ||||
|                                     visible: function (row) { | ||||
|                                         return row.admin_shop_id; | ||||
|                                     } | ||||
|                                 }, | ||||
| 
 | ||||
| 
 | ||||
|                             ], events: Table.api.events.operate,  formatter: function (value, row, index) { | ||||
|                                 if(row.id == Config.admin.id){ | ||||
|                                     return ''; | ||||
|                                 } | ||||
|                                 return Table.api.formatter.operate.call(this, value, row, index); | ||||
|                             }} | ||||
|                             }}, | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|                         // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: function (value, row, index) {
 | ||||
|                         //         if(row.id == Config.admin.id){
 | ||||
|                         //             return '';
 | ||||
|                         //         }
 | ||||
|                         //         return Table.api.formatter.operate.call(this, value, row, index);
 | ||||
|                         //     }}
 | ||||
|                     ] | ||||
|                 ] | ||||
|             }); | ||||
| @ -89,5 +141,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||||
|             } | ||||
|         } | ||||
|     }; | ||||
| 
 | ||||
| 
 | ||||
|     var manystore_url = function (row,dom) { | ||||
|         return 'manystore/index/index?shop_id='+row.admin_shop_id; | ||||
|     } | ||||
| 
 | ||||
|     return Controller; | ||||
| }); | ||||
|  | ||||
| @ -9,6 +9,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||||
|                     add_url: 'manystore/index/add'  + location.search, | ||||
|                     edit_url: 'manystore/index/edit'  + location.search, | ||||
|                     del_url: 'manystore/index/del', | ||||
|                     url_url: 'manystore/index/url', | ||||
|                     free_url: 'manystore/index/free', | ||||
|                     multi_url: 'manystore/index/multi', | ||||
|                 } | ||||
| @ -82,7 +83,40 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||||
| 
 | ||||
| 
 | ||||
|                         {field: 'operate', title: __('Operate'),width:180, table: table , buttons: [ | ||||
|                                 {name: 'free', | ||||
|                                 {name: 'url', | ||||
|                                     text: '查看小程序链接', | ||||
|                                     icon: 'fa fa-chain', | ||||
|                                     classname: 'btn btn-ajax', | ||||
|                                     url: $.fn.bootstrapTable.defaults.extend.url_url, | ||||
|                                     confirm: '查看小程序链接', | ||||
|                                     dropdown : '更多', | ||||
|                                     success: function (data, ret) { | ||||
|                                         //JS将内容放入复制板
 | ||||
|                                         try { | ||||
|                                             navigator.clipboard.writeText(ret.msg); | ||||
|                                             console.log('Text copied to clipboard'); | ||||
|                                             Layer.alert("已自动复制内容 : " + ret.msg ); | ||||
|                                         } catch (err) { | ||||
|                                             console.error('Failed to copy: ', err); | ||||
|                                             Layer.alert("浏览器不支持复制,请自行复制 : " + ret.msg ); | ||||
|                                         } | ||||
| 
 | ||||
|                                         $(".btn-refresh").trigger("click"); | ||||
|                                     }, | ||||
|                                     error: function (data, ret) { | ||||
|                                         Layer.alert(ret.msg); | ||||
|                                         return false; | ||||
|                                     }, | ||||
|                                     // visible: function (row) {
 | ||||
|                                     //     //显示条件 只能待入住订单
 | ||||
|                                     //     if(row.status == '3'){
 | ||||
|                                     //         return true;
 | ||||
|                                     //     }
 | ||||
|                                     //     return false;
 | ||||
|                                     // }
 | ||||
|                                 }, | ||||
| 
 | ||||
|                             {name: 'free', | ||||
|                                     text: '免登录进入机构后台', | ||||
|                                     icon: 'fa fa-sign-in', | ||||
|                                     classname: 'btn btn-ajax', | ||||
|  | ||||
| @ -9,6 +9,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||||
|                     add_url: 'school/classes/activity/activity/add'+ location.search, | ||||
|                     edit_url: 'school/classes/activity/activity/edit'+ location.search, | ||||
|                     del_url: 'school/classes/activity/activity/del', | ||||
|                     url_url: 'school/classes/activity/activity/url', | ||||
|                     multi_url: 'school/classes/activity/activity/multi', | ||||
|                     import_url: 'school/classes/activity/activity/import', | ||||
|                     table: 'school_classes_activity', | ||||
| @ -79,6 +80,38 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||||
| 
 | ||||
|                         {field: 'operate', title: __('Operate'), table: table , buttons: [ | ||||
| 
 | ||||
|                                 {name: 'url', | ||||
|                                     text: '查看小程序链接', | ||||
|                                     icon: 'fa fa-chain', | ||||
|                                     classname: 'btn btn-ajax', | ||||
|                                     url: $.fn.bootstrapTable.defaults.extend.url_url, | ||||
|                                     confirm: '查看小程序链接', | ||||
|                                     dropdown : '更多', | ||||
|                                     success: function (data, ret) { | ||||
|                                         //JS将内容放入复制板
 | ||||
|                                         try { | ||||
|                                             navigator.clipboard.writeText(ret.msg); | ||||
|                                             console.log('Text copied to clipboard'); | ||||
|                                             Layer.alert("已自动复制内容 : " + ret.msg ); | ||||
|                                         } catch (err) { | ||||
|                                             console.error('Failed to copy: ', err); | ||||
|                                             Layer.alert("浏览器不支持复制,请自行复制 : " + ret.msg ); | ||||
|                                         } | ||||
| 
 | ||||
|                                         $(".btn-refresh").trigger("click"); | ||||
|                                     }, | ||||
|                                     error: function (data, ret) { | ||||
|                                         Layer.alert(ret.msg); | ||||
|                                         return false; | ||||
|                                     }, | ||||
|                                     // visible: function (row) {
 | ||||
|                                     //     //显示条件 只能待入住订单
 | ||||
|                                     //     if(row.status == '3'){
 | ||||
|                                     //         return true;
 | ||||
|                                     //     }
 | ||||
|                                     //     return false;
 | ||||
|                                     // }
 | ||||
|                                 }, | ||||
|                                 { | ||||
|                                     name: 'activity_auth', | ||||
|                                     text: __('审核记录'), | ||||
|  | ||||
| @ -10,6 +10,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||||
|                     addnew_url: 'school/classes/classes_lib/addnew'+ location.search, | ||||
|                     edit_url: 'school/classes/classes_lib/edit'+ location.search, | ||||
|                     copy_url: 'school/classes/classes_lib/copy'+ location.search, | ||||
|                     url_url: 'school/classes/classes_lib/url', | ||||
|                     del_url: 'school/classes/classes_lib/del', | ||||
|                     multi_url: 'school/classes/classes_lib/multi', | ||||
|                     import_url: 'school/classes/classes_lib/import', | ||||
| @ -125,6 +126,38 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||||
| 
 | ||||
| 
 | ||||
|                         {field: 'operate', title: __('Operate'), table: table , buttons: [ | ||||
|                                 {name: 'url', | ||||
|                                     text: '查看小程序链接', | ||||
|                                     icon: 'fa fa-chain', | ||||
|                                     classname: 'btn btn-ajax', | ||||
|                                     url: $.fn.bootstrapTable.defaults.extend.url_url, | ||||
|                                     confirm: '查看小程序链接', | ||||
|                                     dropdown : '更多', | ||||
|                                     success: function (data, ret) { | ||||
|                                         //JS将内容放入复制板
 | ||||
|                                         try { | ||||
|                                             navigator.clipboard.writeText(ret.msg); | ||||
|                                             console.log('Text copied to clipboard'); | ||||
|                                             Layer.alert("已自动复制内容 : " + ret.msg ); | ||||
|                                         } catch (err) { | ||||
|                                             console.error('Failed to copy: ', err); | ||||
|                                             Layer.alert("浏览器不支持复制,请自行复制 : " + ret.msg ); | ||||
|                                         } | ||||
| 
 | ||||
|                                         $(".btn-refresh").trigger("click"); | ||||
|                                     }, | ||||
|                                     error: function (data, ret) { | ||||
|                                         Layer.alert(ret.msg); | ||||
|                                         return false; | ||||
|                                     }, | ||||
|                                     // visible: function (row) {
 | ||||
|                                     //     //显示条件 只能待入住订单
 | ||||
|                                     //     if(row.status == '3'){
 | ||||
|                                     //         return true;
 | ||||
|                                     //     }
 | ||||
|                                     //     return false;
 | ||||
|                                     // }
 | ||||
|                                 }, | ||||
|                                 { | ||||
|                                     name: 'classes_spec', | ||||
|                                     text: __('复制并创建课程'), | ||||
| @ -596,7 +629,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||||
|     } | ||||
| 
 | ||||
|     var manystore_url = function (row,dom) { | ||||
|         return 'manystore/index/index?id='+row.classes_activity_auth_id; | ||||
|         return 'manystore/index/index?shop_id='+row.shop_id; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -11,6 +11,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||||
|                     del_url: 'school/classes/teacher/del', | ||||
|                     multi_url: 'school/classes/teacher/multi', | ||||
|                     import_url: 'school/classes/teacher/import', | ||||
|                     url_url: 'school/classes/teacher/url', | ||||
|                     table: 'school_teacher', | ||||
|                 } | ||||
|             }); | ||||
| @ -64,6 +65,39 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||||
|                         {field: 'shop.address_detail', title: __('Shop.address_detail'), operate: 'LIKE'}, | ||||
| 
 | ||||
|                         {field: 'operate', title: __('Operate'), table: table , buttons: [ | ||||
|                                 {name: 'url', | ||||
|                                     text: '查看小程序链接', | ||||
|                                     icon: 'fa fa-chain', | ||||
|                                     classname: 'btn btn-ajax', | ||||
|                                     url: $.fn.bootstrapTable.defaults.extend.url_url, | ||||
|                                     confirm: '查看小程序链接', | ||||
|                                     dropdown : '更多', | ||||
|                                     success: function (data, ret) { | ||||
|                                         //JS将内容放入复制板
 | ||||
|                                         try { | ||||
|                                              navigator.clipboard.writeText(ret.msg); | ||||
|                                             console.log('Text copied to clipboard'); | ||||
|                                             Layer.alert("已自动复制内容 : " + ret.msg ); | ||||
|                                         } catch (err) { | ||||
|                                             console.error('Failed to copy: ', err); | ||||
|                                             Layer.alert("浏览器不支持复制,请自行复制 : " + ret.msg ); | ||||
|                                         } | ||||
| 
 | ||||
|                                         $(".btn-refresh").trigger("click"); | ||||
|                                     }, | ||||
|                                     error: function (data, ret) { | ||||
|                                         Layer.alert(ret.msg); | ||||
|                                         return false; | ||||
|                                     }, | ||||
|                                     // visible: function (row) {
 | ||||
|                                     //     //显示条件 只能待入住订单
 | ||||
|                                     //     if(row.status == '3'){
 | ||||
|                                     //         return true;
 | ||||
|                                     //     }
 | ||||
|                                     //     return false;
 | ||||
|                                     // }
 | ||||
|                                 }, | ||||
| 
 | ||||
|                                 { | ||||
|                                     name: 'classes', | ||||
|                                     text: __('讲师的课程'), | ||||
|  | ||||
| @ -145,7 +145,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||||
|     }; | ||||
| 
 | ||||
|     var message_config_item_url = function (row,dom) { | ||||
|         return 'school/message_config_item/index?event='+row.event + "&name=" + row.name; | ||||
|         return 'school/message_config_item/index?event='+row.event; | ||||
|     } | ||||
|     return Controller; | ||||
| }); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user