作者 曹东东
@@ -295,4 +295,17 @@ return [ @@ -295,4 +295,17 @@ return [
295 //API接口地址 295 //API接口地址
296 'api_url' => 'https://api.fastadmin.net', 296 'api_url' => 'https://api.fastadmin.net',
297 ], 297 ],
  298 + //公众号
  299 + 'officialAccount'=>[
  300 + 'app_id' => 'wx401d047673f1c578',
  301 + 'secret' => '2f99955f1964d30d6e962c345c268274',
  302 + 'token' => 'wlzj3',
  303 + 'response_type' => 'array',
  304 + 'aes_key' => 'fT6nItu6itza0uIvFngi1AocwITGqOEe6GUCoqgTFDz'
  305 + ],
  306 + //公众号 模板消息 模板id
  307 + 'templateMessage'=>[
  308 + //审核通知
  309 + 'currency' => 'QUWHawyGohboStMgzZ4B4vQbqeFGWEnd-6MPh7jM8QQ',
  310 + ],
298 ]; 311 ];
@@ -7,11 +7,14 @@ use app\common\controller\TeacherBase; @@ -7,11 +7,14 @@ use app\common\controller\TeacherBase;
7 use app\school\model\basic\Clazz; 7 use app\school\model\basic\Clazz;
8 use app\school\model\basic\College; 8 use app\school\model\basic\College;
9 use app\school\model\basic\Specialty; 9 use app\school\model\basic\Specialty;
  10 +use EasyWeChat\Factory;
10 use fast\Random; 11 use fast\Random;
  12 +use Overtrue\Socialite\AuthorizeFailedException;
11 use think\addons\Service; 13 use think\addons\Service;
12 use think\Cache; 14 use think\Cache;
13 use think\Config; 15 use think\Config;
14 use think\Db; 16 use think\Db;
  17 +use think\Exception;
15 use think\Lang; 18 use think\Lang;
16 use Upyun\Upyun; 19 use Upyun\Upyun;
17 20
@@ -22,7 +25,8 @@ use Upyun\Upyun; @@ -22,7 +25,8 @@ use Upyun\Upyun;
22 class Ajax extends TeacherBase 25 class Ajax extends TeacherBase
23 { 26 {
24 27
25 - protected $noNeedLogin = ['lang','canvas','upyun_upload']; 28 + protected $noNeedLogin = ['lang'];
  29 + //'canvas','upyun_upload'
26 protected $noNeedRight = ['*']; 30 protected $noNeedRight = ['*'];
27 protected $layout = ''; 31 protected $layout = '';
28 32
@@ -310,9 +314,13 @@ class Ajax extends TeacherBase @@ -310,9 +314,13 @@ class Ajax extends TeacherBase
310 public function canvas(){ 314 public function canvas(){
311 $id = input('id'); 315 $id = input('id');
312 if ($this->request->isPost()){ 316 if ($this->request->isPost()){
313 - if (!$id) $this->error('用户数据异常'); 317 + if (!$id) $this->error('用户项目数据异常');
  318 + if (!$this->auth) $this->error('当前登录用户数据异常');
  319 + $teacher_name = $this->auth['username'];
314 $teacher_id = $this->auth['id']; 320 $teacher_id = $this->auth['id'];
315 - $detail = Db::table('fa_project_register')->where(['review_stage' => 0,'project_approval_status' => 0,'item_id' => $id])->find(); 321 + $detail = Db::table('fa_project_register')->where(['id' => $id])->find();
  322 + if ($detail['review_stage'] != 0) $this->error('用户项目数据不在立项评审阶段');
  323 + if ($detail['project_approval_status'] != 0) $this->error('用户项目数据不在立项审核阶段');
316 if (!$detail) $this->error('项目数据异常'); 324 if (!$detail) $this->error('项目数据异常');
317 //判断是否是审核成员 325 //判断是否是审核成员
318 $member_ids = Db::table('fa_members') 326 $member_ids = Db::table('fa_members')
@@ -345,7 +353,6 @@ class Ajax extends TeacherBase @@ -345,7 +353,6 @@ class Ajax extends TeacherBase
345 } 353 }
346 } 354 }
347 //通过:project_approval_status => 1 退回:project_status => 2 355 //通过:project_approval_status => 1 退回:project_status => 2
348 -  
349 $data['signature_url'] = $file_url; 356 $data['signature_url'] = $file_url;
350 $data['updatetime'] = time(); 357 $data['updatetime'] = time();
351 if ($type == 2){ 358 if ($type == 2){
@@ -356,6 +363,8 @@ class Ajax extends TeacherBase @@ -356,6 +363,8 @@ class Ajax extends TeacherBase
356 $msg = '通过'; 363 $msg = '通过';
357 } 364 }
358 Db::table("fa_project_register")->where('id',$id)->update($data); 365 Db::table("fa_project_register")->where('id',$id)->update($data);
  366 + //项目类型
  367 + $project_type_name = Db::table('fa_project_type')->where('id',$detail['project_type'])->value('name');
359 //fa_register_log project_type_name => fa_project_register.project_type--fa_project_type 368 //fa_register_log project_type_name => fa_project_register.project_type--fa_project_type
360 $log['register_id'] = $id; 369 $log['register_id'] = $id;
361 $log['container_id'] = $detail['container_id']; 370 $log['container_id'] = $detail['container_id'];
@@ -366,13 +375,33 @@ class Ajax extends TeacherBase @@ -366,13 +375,33 @@ class Ajax extends TeacherBase
366 $log['verify_stage'] = 0; 375 $log['verify_stage'] = 0;
367 $log['project_name'] = $detail['project_name']; 376 $log['project_name'] = $detail['project_name'];
368 $log['project_type'] = $detail['project_type']; 377 $log['project_type'] = $detail['project_type'];
369 - $log['project_type_name'] = Db::table('fa_project_type')->where('id',$detail['project_type'])->value('name'); 378 + $log['project_type_name'] = $project_type_name;
370 $log['created_time'] = datetime('Y-m-d H:i:s',time()); 379 $log['created_time'] = datetime('Y-m-d H:i:s',time());
371 - $log['teacher_name'] = $this->auth['teacher_name']; 380 + $log['teacher_name'] = $teacher_name;
372 $log['job_num'] = $this->auth['job_num']; 381 $log['job_num'] = $this->auth['job_num'];
373 $log['operation'] = '项目审核' . $msg; 382 $log['operation'] = '项目审核' . $msg;
374 - $log['memo'] = '项目审核'; 383 + $log['memo'] = $opinion;
375 Db::table("fa_register_log")->insert($log); 384 Db::table("fa_register_log")->insert($log);
  385 + $open_id = Db::table('fa_user')->where('id',$detail['user_id'])->value('open_id');
  386 + if ($open_id){
  387 + $config = Config::get('officialAccount');
  388 + $app = Factory::officialAccount($config);
  389 + $app->template_message->send([
  390 + 'touser' => $open_id,
  391 + 'template_id' => 'QUWHawyGohboStMgzZ4B4vQbqeFGWEnd-6MPh7jM8QQ',
  392 + 'data' => array(
  393 + 'first' => array('value' => "项目审核结果通知", 'color' => ''),
  394 + 'keyword1' => array('value' => $project_type_name, 'color' => ''),
  395 + 'keyword2' => array('value' => $detail['project_name'], 'color' => ''),
  396 + 'keyword3' => array('value' => $msg, 'color' => ''),
  397 + 'keyword4' => array('value' => $teacher_name, 'color' => ''),
  398 + 'keyword5' => array('value' => $opinion, 'color' => ''),
  399 + 'remark' => array('value' => '【您报名参加的' . $detail['project_name'] . '】被' . $msg, 'color' => ''),
  400 + ),
  401 + ]);
  402 + }
  403 +
  404 +
376 $this->success('操作成功',$file_url); 405 $this->success('操作成功',$file_url);
377 } 406 }
378 $this->view->assign('id',$id); 407 $this->view->assign('id',$id);
@@ -8,8 +8,9 @@ @@ -8,8 +8,9 @@
8 <script src="__CDN__/assets/js/jquery-3.4.1.min.js"></script> 8 <script src="__CDN__/assets/js/jquery-3.4.1.min.js"></script>
9 </head> 9 </head>
10 10
11 -<body> 11 +<body style="margin: 0;">
12 <div class="popverBox"> 12 <div class="popverBox">
  13 + <div class="titleBox">项目审核</div>
13 <div id="signSure" class="signSure"> 14 <div id="signSure" class="signSure">
14 <input type="hidden" name="id" id="id" value="{$id}"> 15 <input type="hidden" name="id" id="id" value="{$id}">
15 <div class="topBtnBox"> 16 <div class="topBtnBox">
@@ -34,7 +35,7 @@ @@ -34,7 +35,7 @@
34 35
35 <script> 36 <script>
36 function sureWriteCallback(imageBase64){ 37 function sureWriteCallback(imageBase64){
37 - // 签名完成后的的逻辑代码... 38 + // 签名完成后的的逻辑代码
38 $.ajax({ 39 $.ajax({
39 type : "POST", //提交方式 40 type : "POST", //提交方式
40 url : "canvas",//路径 41 url : "canvas",//路径
@@ -45,7 +46,12 @@ @@ -45,7 +46,12 @@
45 'opinion' : $('#opinion').val() 46 'opinion' : $('#opinion').val()
46 },//数据,这里使用的是Json格式进行传输 47 },//数据,这里使用的是Json格式进行传输
47 success:function (data) { 48 success:function (data) {
48 - layer.msg('签名成功'); 49 + console.log('成功');
  50 + alert(data.msg)
  51 + },
  52 + error:function (data) {
  53 + console.log('失败')
  54 + alert(data.msg)
49 } 55 }
50 }) 56 })
51 } 57 }
@@ -61,30 +67,38 @@ @@ -61,30 +67,38 @@
61 67
62 <style> 68 <style>
63 .popverBox{ 69 .popverBox{
64 - background: #666;; 70 + background: #f2f2f2;
65 position: relative; 71 position: relative;
66 font-size: 30px; 72 font-size: 30px;
67 - /*height: 900px;*/ 73 + display: flex;
  74 + align-items: center;
  75 + flex-direction: column;
  76 + height: 100vh;
68 } 77 }
69 .signSure{ 78 .signSure{
70 - position: absolute;  
71 - left: 9%;  
72 - top: 4%;  
73 - /*transform: translate(-50%, -50%);*/  
74 - width: 80%;  
75 - background: #fff; 79 + width: 90%;
76 border-radius: 16px; 80 border-radius: 16px;
77 padding: 20px 12px 28px 12px; 81 padding: 20px 12px 28px 12px;
78 } 82 }
  83 + .titleBox{
  84 + color: #fff;
  85 + background-color: #4285dc;
  86 + display: flex;
  87 + align-items: center;
  88 + justify-content: center;
  89 + width: 100%;
  90 + height: 7rem;
  91 + font-size: 2.5rem;
  92 + }
79 .topTitle{ 93 .topTitle{
80 margin: 20px 0 12px 12px; 94 margin: 20px 0 12px 12px;
81 - font-size: 30px; 95 + font-size: 2.3rem;
82 } 96 }
83 .whiteBord{ 97 .whiteBord{
84 width: 100%; 98 width: 100%;
85 height: 400px; 99 height: 400px;
86 - border: 1px solid #eee;  
87 - background: #f6f6f6; 100 + border: 1px solid #000;
  101 + background: #fff;
88 margin: 0 auto; 102 margin: 0 auto;
89 border-radius: 4px; 103 border-radius: 4px;
90 margin-bottom: 12px; 104 margin-bottom: 12px;
@@ -117,22 +131,22 @@ @@ -117,22 +131,22 @@
117 } 131 }
118 .opinion{ 132 .opinion{
119 width: 100%; 133 width: 100%;
120 - height: 179px; 134 + height: 235px;
121 font-size: 30px; 135 font-size: 30px;
122 - color: white; 136 + border: 1px solid #000;
123 } 137 }
124 138
125 .opinion::-webkit-input-placeholder{ 139 .opinion::-webkit-input-placeholder{
126 - height: 179px;line-height: 179px 140 + line-height: 235px;text-align: center;
127 }/* 使用webkit内核的浏览器 */ 141 }/* 使用webkit内核的浏览器 */
128 .opinion:-moz-placeholder{ 142 .opinion:-moz-placeholder{
129 - height: 179px;line-height: 179px 143 + line-height: 235px;text-align: center;
130 }/* Firefox版本4-18 */ 144 }/* Firefox版本4-18 */
131 .opinion::-moz-placeholder{ 145 .opinion::-moz-placeholder{
132 - height: 179px;line-height: 179px 146 + line-height: 235px;text-align: center;
133 }/* Firefox版本19+ */ 147 }/* Firefox版本19+ */
134 .opinion:-ms-input-placeholder{ 148 .opinion:-ms-input-placeholder{
135 - height: 179px;line-height: 179px 149 + line-height: 235px;text-align: center;
136 } 150 }
137 151
138 </style> 152 </style>