alias($alirs) : $model; $alirs = $alirs === '' ? $alirs : $alirs . '.'; $model = $model->where("{$alirs}is_del", 0); $model = $model->where("entry_type",$where["entry_type"]); if ($where['title'] && $where['title']) $model = $model->where("{$alirs}merchant_name", 'LIKE', "%$where[title]%"); return $model; } /**讲师列表 * @param $where * @return array * @throws \think\Exception */ public static function getLecturerList($where) { $data = self::setWhere($where)->page((int)$where['page'], (int)$where['limit'])->select(); $data = count($data) ? $data->toArray() : []; foreach ($data as $key => &$value) { $value['address'] = $value['province'] . $value['city'] . $value['district'] . $value['address']; $value['success_time'] = date('Y-m-d H:i:s', $value['success_time']); $value['fail_time'] = date('Y-m-d H:i:s', $value['fail_time']); } $count = self::setWhere($where)->count(); return compact('data', 'count'); } /** * 删除讲师申请 * @param $id * @return bool|int * @throws \think\exception\DbException */ public static function delLecturer($id) { $lecturer = self::get($id); if (!$lecturer) return self::setErrorInfo('删除的数据不存在'); return self::where('id', $id)->delete(); } /**审核失败 * @param $id * @param $fail_msg * @return bool * @throws \think\exception\DbException */ public static function changeFail($id, $uid, $fail_message, $enter) { $fail_time = time(); $status = -1; try { $wechat_notification_message = SystemConfigService::get('wechat_notification_message'); if ($wechat_notification_message == 1) { WechatTemplateService::sendTemplate(WechatUser::uidToOpenid($uid), WechatTemplateService::EXAMINE_RESULT, [ 'first' => '尊敬的用户,您提交讲师入住申请审核结果已出。', 'keyword1' => '审核失败', 'keyword2' => date('Y-m-d H:i:s', time()), 'remark' => '失败原因:' . $fail_message ], Url::build('wap/spread/spread', [], true, true)); } else { $dat['phrase5']['value'] = '审核失败'; $dat['time24']['value'] = date('Y-m-d H:i:s', time()); $dat['thing4']['value'] = '失败原因:' . $fail_message; RoutineTemplate::sendExamineResult($dat, $uid, Url::build('wap/spread/spread', [], true, true)); } } catch (\Exception $e) { } $site_name = SystemConfigService::get('site_name'); $sms_platform_selection = SystemConfigService::get('sms_platform_selection'); if ($sms_platform_selection == 1) { $approval_failed_template_id = SystemConfigService::get('approval_failed_template_id');//审核未通过模版ID if ($approval_failed_template_id) { $data['site_name'] = $site_name; AliMessageService::sendmsg($enter['link_tel'], $approval_failed_template_id, $data); } } else { $data['site_name'] = $site_name; $data['phone'] = $enter['link_tel']; SmsTemplate::sendSms($uid, $data, 'ENTRY_FAILED'); } return self::edit(compact('fail_time', 'fail_message', 'status'), $id); } /**审核成功 * @param $id * @return bool */ public static function changeSuccess($id, $uid, $enter) { $success_time = time(); $status = 1; try { $wechat_notification_message = SystemConfigService::get('wechat_notification_message'); if ($wechat_notification_message == 1) { WechatTemplateService::sendTemplate(WechatUser::uidToOpenid($uid), WechatTemplateService::EXAMINE_RESULT, [ 'first' => '尊敬的用户,您提交讲师入住申请审核结果已出。', 'keyword1' => '审核成功', 'keyword2' => date('Y-m-d H:i:s', time()), 'remark' => '感恩您的参与和支持,谢谢!' ], Url::build('wap/spread/spread', [], true, true)); } else { $dat['phrase5']['value'] = '审核成功'; $dat['time24']['value'] = date('Y-m-d H:i:s', time()); $dat['thing4']['value'] = '感恩您的参与和支持,谢谢!'; RoutineTemplate::sendExamineResult($dat, $uid, Url::build('wap/spread/spread', [], true, true)); } } catch (\Exception $e) { } $site_name = SystemConfigService::get('site_name'); $sms_platform_selection = SystemConfigService::get('sms_platform_selection'); if ($sms_platform_selection == 1) { $approved_template_id = SystemConfigService::get('approved_template_id');//审核通过模版ID if ($approved_template_id) { $data['site_name'] = $site_name; $data['phone'] = $enter['link_tel']; $data['pwd'] = '123456'; AliMessageService::sendmsg($enter['link_tel'], $approved_template_id, $data); } } else { $site_name = SystemConfigService::get('site_name'); $data['site_name'] = $site_name; $data['phone'] = $enter['link_tel']; $data['pwd'] = '123456'; SmsTemplate::sendSms($uid, $data, 'SETTLED_THROUGH'); } return self::edit(compact('status', 'success_time'), $id); } }