Audit.php 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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. if(empty($post['mono'])){
  118. return app('json')->fail( '请输入驳回理由');
  119. }
  120. (new InfoAudit)
  121. ->where('id', $post['id'])
  122. ->save([
  123. 'status' => -1,
  124. 'admin_mono' => $post['mono'],
  125. 'admin_time' => time(),
  126. 'admin_id' => $request->adminInfo['id'],
  127. ]);
  128. return app('json')->success('已驳回');
  129. }
  130. }
  131. /**
  132. * 平台认证初始化
  133. * @return type
  134. */
  135. public function typeAuditInit()
  136. {
  137. return app('json')->success([
  138. 'all' => (new TypeAudit)->count(),
  139. 'wait' => (new TypeAudit)->where('status', 0)->count(),
  140. 'ok' => (new TypeAudit)->where('status', 1)->count(),
  141. 'no' => (new TypeAudit)->where('status', -1)->count(),
  142. ]);
  143. }
  144. /**
  145. * 平台认证详情
  146. * @param Request $request
  147. */
  148. public function typeAuditInfo(Request $request){
  149. $post = UtilService::getMore([
  150. ['id', '', 'empty', '参数错误'],
  151. ], $request);
  152. $data = (new TypeAudit)->getItem($post,1);
  153. if(empty($data)){
  154. return app('json')->fail('数据不存在');
  155. }
  156. return app('json')->success($data);
  157. }
  158. /**
  159. * 获取平台认证审核列表
  160. * @param Request $request
  161. */
  162. public function typeAuditList(Request $request)
  163. {
  164. $post = UtilService::getMore(
  165. [
  166. ['page', 1],
  167. ['pageSize', 50],
  168. ['keyword',''],
  169. ['mobile',''],
  170. ['user_mobile',''],
  171. ['status', ''],
  172. ['uid', ''],
  173. ['time',[]],
  174. ], $request
  175. );
  176. $data = (new TypeAudit)->getList($post,1);
  177. return app('json')->success([
  178. 'list' => $data["list"],
  179. 'pageCount' => $data["totalCount"],
  180. 'pageSize' => $data["pageSize"],
  181. 'page' => $data["page"],
  182. ]);
  183. }
  184. /**
  185. * 第一步审核处理
  186. * @param Request $request
  187. */
  188. public function typeAuditSub(Request $request)
  189. {
  190. $post = UtilService::getMore(
  191. [
  192. ['id', '', 'empty', '参数错误'],
  193. ['mono'],
  194. ['type', 0],
  195. ], $request);
  196. $certData = (new TypeAudit)->where('id', $post['id'])->find();
  197. if (empty($certData)) {
  198. return app('json')->fail('数据不存在');
  199. }
  200. if ($certData['status']!=0) {
  201. return app('json')->fail( '当前审核已处理');
  202. }
  203. //审核通过
  204. if ($post['type'] == 1) {
  205. (new TypeAudit)
  206. ->where('id', $post['id'])
  207. ->save([
  208. 'status' => 1,
  209. 'admin_mono' => $post['mono'],
  210. 'admin_time' => time(),
  211. 'admin_id' => $request->adminInfo['id'],
  212. ]);
  213. return app('json')->success('操作成功');
  214. }
  215. //审核驳回
  216. if ($post['type'] == -1) {
  217. if(empty($post['mono'])){
  218. return app('json')->fail( '请输入驳回理由');
  219. }
  220. (new TypeAudit)
  221. ->where('id', $post['id'])
  222. ->save([
  223. 'status' => -1,
  224. 'admin_mono' => $post['mono'],
  225. 'admin_time' => time(),
  226. 'admin_id' => $request->adminInfo['id'],
  227. ]);
  228. return app('json')->success('已驳回');
  229. }
  230. }
  231. }