Audit.php 7.3 KB

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