Audit.php 7.7 KB

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