Audit.php 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | [ WE CAN DO IT MORE SIMPLE ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2018-2020 rights reserved.
  6. // +----------------------------------------------------------------------
  7. // |
  8. // +----------------------------------------------------------------------
  9. // | Date: 2020-11-08 12:56
  10. // +----------------------------------------------------------------------
  11. namespace app\system\controller;
  12. use app\BaseController;
  13. use app\model\api\User as UserModel;
  14. use app\model\api\ServiceType as ServiceTypeModel;
  15. use app\model\api\UserShowTemplate;
  16. use app\model\api\InfoAudit;
  17. use app\model\api\TypeAudit;
  18. use app\model\api\UserAudit;
  19. use app\model\api\ServiceType;
  20. use app\model\api\ServiceTimeType;
  21. use app\model\api\City as CityModel;
  22. use app\model\api\Sys as SysModel;
  23. use think\db\exception\DbException;
  24. use think\facade\Db;
  25. use app\Request;
  26. use library\services\UtilService;
  27. use library\utils\UserUtilsTool;
  28. class Audit extends BaseController
  29. {
  30. /***********************************审核******************************/
  31. /**
  32. * 第一步审核初始化
  33. * @return type
  34. */
  35. public function infoAuditInit()
  36. {
  37. return app('json')->success([
  38. 'all' => (new InfoAudit)->count(),
  39. 'wait' => (new InfoAudit)->where('status', 0)->count(),
  40. 'ok' => (new InfoAudit)->where('status', 1)->count(),
  41. 'no' => (new InfoAudit)->where('status', -1)->count(),
  42. ]);
  43. }
  44. /**
  45. * 获取第一步审核列表
  46. * @param Request $request
  47. */
  48. public function infoAuditList(Request $request)
  49. {
  50. $post = UtilService::getMore(
  51. [
  52. ['page', 1],
  53. ['pageSize', 50],
  54. ['keyword',''],
  55. ['mobile',''],
  56. ['user_mobile',''],
  57. ['status', ''],
  58. ['uid', ''],
  59. ['time',[]],
  60. ], $request
  61. );
  62. $data = (new InfoAudit)->getList($post,1);
  63. return app('json')->success([
  64. 'list' => $data["list"],
  65. 'pageCount' => $data["totalCount"],
  66. 'pageSize' => $data["pageSize"],
  67. 'page' => $data["page"],
  68. ]);
  69. }
  70. /**
  71. * 信息认证详情
  72. * @param Request $request
  73. */
  74. public function infoAuditInfo(Request $request){
  75. $post = UtilService::getMore([
  76. ['id', '', 'empty', '参数错误'],
  77. ], $request);
  78. $data = (new InfoAudit)->getItem($post,1);
  79. if(empty($data)){
  80. return app('json')->fail('数据不存在');
  81. }
  82. return app('json')->success($data);
  83. }
  84. /**
  85. * 第一步审核处理
  86. * @param Request $request
  87. */
  88. public function infoAuditSub(Request $request)
  89. {
  90. $post = UtilService::getMore(
  91. [
  92. ['id', '', 'empty', '参数错误'],
  93. ['mono'],
  94. ['type', 0],
  95. ], $request);
  96. $certData = (new InfoAudit)->where('id', $post['id'])->find();
  97. if (empty($certData)) {
  98. return app('json')->fail('数据不存在');
  99. }
  100. if ($certData['status']!=0) {
  101. return app('json')->fail( '当前审核已处理');
  102. }
  103. //审核通过
  104. if ($post['type'] == 1) {
  105. (new InfoAudit)
  106. ->where('id', $post['id'])
  107. ->save([
  108. 'status' => 1,
  109. 'admin_mono' => $post['mono'],
  110. 'admin_time' => time(),
  111. 'admin_id' => $request->adminInfo['id'],
  112. ]);
  113. //更新职称
  114. (new UserModel)->where("uid",$certData["uid"])->update(["work_type_id"=>$certData["user_work_type_id"]]);
  115. //绑定初始化模板
  116. (new UserShowTemplate)->userBindTempInit($certData["uid"]);
  117. //删除以前的资料
  118. (new InfoAudit)->where('uid', $certData['uid'])->where("id","<>",$certData["id"])->delete();
  119. return app('json')->success('操作成功');
  120. }
  121. //审核驳回
  122. if ($post['type'] == -1) {
  123. if(empty($post['mono'])){
  124. return app('json')->fail( '请输入驳回理由');
  125. }
  126. (new InfoAudit)
  127. ->where('id', $post['id'])
  128. ->save([
  129. 'status' => -1,
  130. 'admin_mono' => $post['mono'],
  131. 'admin_time' => time(),
  132. 'admin_id' => $request->adminInfo['id'],
  133. ]);
  134. return app('json')->success('已驳回');
  135. }
  136. }
  137. /**
  138. * 平台认证初始化
  139. * @return type
  140. */
  141. public function typeAuditInit()
  142. {
  143. return app('json')->success([
  144. 'all' => (new TypeAudit)->count(),
  145. 'wait' => (new TypeAudit)->where('status', 0)->count(),
  146. 'ok' => (new TypeAudit)->where('status', 1)->count(),
  147. 'no' => (new TypeAudit)->where('status', -1)->count(),
  148. ]);
  149. }
  150. /**
  151. * 平台认证详情
  152. * @param Request $request
  153. */
  154. public function typeAuditInfo(Request $request){
  155. $post = UtilService::getMore([
  156. ['id', '', 'empty', '参数错误'],
  157. ], $request);
  158. $data = (new TypeAudit)->getItem($post,1);
  159. if(empty($data)){
  160. return app('json')->fail('数据不存在');
  161. }
  162. return app('json')->success($data);
  163. }
  164. /**
  165. * 获取平台认证审核列表
  166. * @param Request $request
  167. */
  168. public function typeAuditList(Request $request)
  169. {
  170. $post = UtilService::getMore(
  171. [
  172. ['page', 1],
  173. ['pageSize', 50],
  174. ['keyword',''],
  175. ['mobile',''],
  176. ['user_mobile',''],
  177. ['status', ''],
  178. ['uid', ''],
  179. ['time',[]],
  180. ], $request
  181. );
  182. $data = (new TypeAudit)->getList($post,1);
  183. return app('json')->success([
  184. 'list' => $data["list"],
  185. 'pageCount' => $data["totalCount"],
  186. 'pageSize' => $data["pageSize"],
  187. 'page' => $data["page"],
  188. ]);
  189. }
  190. /**
  191. * 第一步审核处理
  192. * @param Request $request
  193. */
  194. public function typeAuditSub(Request $request)
  195. {
  196. $post = UtilService::getMore(
  197. [
  198. ['id', '', 'empty', '参数错误'],
  199. ['mono'],
  200. ['type', 0],
  201. ], $request);
  202. $certData = (new TypeAudit)->where('id', $post['id'])->find();
  203. if (empty($certData)) {
  204. return app('json')->fail('数据不存在');
  205. }
  206. if ($certData['status']!=0) {
  207. return app('json')->fail( '当前审核已处理');
  208. }
  209. //审核通过
  210. if ($post['type'] == 1) {
  211. (new TypeAudit)
  212. ->where('id', $post['id'])
  213. ->save([
  214. 'status' => 1,
  215. 'admin_mono' => $post['mono'],
  216. 'admin_time' => time(),
  217. 'admin_id' => $request->adminInfo['id'],
  218. ]);
  219. //删除以前的资料
  220. (new TypeAudit)->where('uid', $certData['uid'])->where("id","<>",$certData["id"])->delete();
  221. return app('json')->success('操作成功');
  222. }
  223. //审核驳回
  224. if ($post['type'] == -1) {
  225. if(empty($post['mono'])){
  226. return app('json')->fail( '请输入驳回理由');
  227. }
  228. (new TypeAudit)
  229. ->where('id', $post['id'])
  230. ->save([
  231. 'status' => -1,
  232. 'admin_mono' => $post['mono'],
  233. 'admin_time' => time(),
  234. 'admin_id' => $request->adminInfo['id'],
  235. ]);
  236. return app('json')->success('已驳回');
  237. }
  238. }
  239. }