Inform.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 山西牛酷信息科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com.cn
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
  9. * 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
  10. * =========================================================
  11. */
  12. namespace app\admin\controller;
  13. use app\model\goods\Inform as InformModel;
  14. use app\model\goods\InformSubject as InformSubjectModel;
  15. use app\model\goods\InformSubjectType as InformSubjectTypeModel;
  16. /**
  17. * 商品管理 控制器
  18. */
  19. class Inform extends BaseAdmin
  20. {
  21. /**
  22. * 举报列表
  23. * @return mixed
  24. */
  25. public function lists()
  26. {
  27. if (request()->isAjax()) {
  28. $page = input('page', 1);
  29. $page_size = input('page_size', PAGE_LIST_ROWS);
  30. $search_text = input('search_text', '');
  31. $site_id = input("site_id", "");
  32. $state = input("state", "");
  33. $subject_id = input("subject_id", "");
  34. $condition = [];
  35. if ($search_text) {
  36. $condition[] = [ 'sku_name', 'like', '%' . $search_text . '%' ];
  37. }
  38. if (!empty($site_id)) {
  39. $condition[] = [ 'site_id', '=', $site_id ];
  40. }
  41. if (!empty($state)) {
  42. $condition[] = [ 'state', '=', $state ];
  43. }
  44. if (!empty($subject_id)) {
  45. $condition[] = [ 'subject_id', '=', $subject_id ];
  46. }
  47. $order = 'create_time desc';
  48. $field = '*';
  49. $inform_model = new InformModel();
  50. return $inform_model->getInformPageList($condition, $page, $page_size, $order, $field);
  51. } else {
  52. $this->forthMenu();
  53. return $this->fetch("inform/lists");
  54. }
  55. }
  56. /**
  57. *举报类型
  58. */
  59. public function subjecttype()
  60. {
  61. if (request()->isAjax()) {
  62. $page = input('page', 1);
  63. $page_size = input('page_size', PAGE_LIST_ROWS);
  64. $order = '';
  65. $condition = [];
  66. $field = '*';
  67. $subjecttype_model = new InformSubjectTypeModel();
  68. return $subjecttype_model->getSubjectTypePageList($condition, $page, $page_size, $order, $field);
  69. } else {
  70. $this->forthMenu();
  71. return $this->fetch("inform/subjecttype");
  72. }
  73. }
  74. /**
  75. *举报主题
  76. */
  77. public function subject()
  78. {
  79. if (request()->isAjax()) {
  80. $page = input('page', 1);
  81. $page_size = input('page_size', PAGE_LIST_ROWS);
  82. $order = '';
  83. $condition = [];
  84. $field = '*';
  85. $subjecttype_model = new InformSubjectModel();
  86. return $subjecttype_model->getSubjectPageList($condition, $page, $page_size, $order, $field);
  87. } else {
  88. $this->forthMenu();
  89. $subjecttype_model = new InformSubjectTypeModel();
  90. $subjecttype = $subjecttype_model->getSubjectTypeList();
  91. $this->assign("list", $subjecttype['data']);
  92. return $this->fetch("inform/subject");
  93. }
  94. }
  95. /**举报类型添加
  96. * @return mixed
  97. */
  98. public function subjecttypeadd()
  99. {
  100. if (request()->isAjax()) {
  101. $data = [
  102. 'type_name' => input('type_name', ''),
  103. 'type_desc' => input('type_desc', ''),
  104. ];
  105. $type_model = new InformSubjectTypeModel();
  106. return $type_model->addSubjectType($data);
  107. } else {
  108. return $this->fetch("inform/subjecttypeadd");
  109. }
  110. }
  111. /**举报主题添加
  112. * @return mixed
  113. */
  114. public function subjectadd()
  115. {
  116. if (request()->isAjax()) {
  117. $data = [
  118. 'subject_content' => input('subject_content', ''),
  119. 'subject_type_id' => input('subject_type_id', ''),
  120. 'subject_type_name' => input('type_name', ''),
  121. ];
  122. $type_model = new InformSubjectModel();
  123. return $type_model->addSubject($data);
  124. } else {
  125. $subjecttype_model = new InformSubjectTypeModel();
  126. $subjecttype = $subjecttype_model->getSubjectTypeList();
  127. $this->assign("typeid", $subjecttype['data']);
  128. return $this->fetch("inform/subjectadd");
  129. }
  130. }
  131. /**删除举报主题
  132. * @return mixed
  133. */
  134. public function deletesubject()
  135. {
  136. if (request()->isAjax()) {
  137. $subject_id = input('subject_id', 0);
  138. $gift_model = new InformSubjectModel();
  139. return $gift_model->deleteSubject([ [ 'subject_id', '=', $subject_id ] ]);
  140. }
  141. }
  142. /**删除举报类型
  143. * @return mixed
  144. */
  145. public function deletesubjecttype()
  146. {
  147. if (request()->isAjax()) {
  148. $type_id = input('type_id', 0);
  149. $gift_model = new InformSubjectTypeModel();
  150. return $gift_model->deleteSubjectType([ [ 'type_id', '=', $type_id ] ]);
  151. }
  152. }
  153. /**举报详情
  154. * @return mixed
  155. */
  156. public function detail()
  157. {
  158. if (request()->isAjax()) {
  159. $inform_id = input('inform_id', 0);
  160. $order_model = new InformModel();
  161. $order_info = $order_model->getInformInfo([ [ 'inform_id', '=', $inform_id ] ]);
  162. return $order_info;
  163. }
  164. }
  165. /**举报类型详情
  166. * @return mixed
  167. */
  168. public function subjecttypeinfo()
  169. {
  170. if (request()->isAjax()) {
  171. $type_id = input('type_id', 0);
  172. $type_model = new InformSubjectTypeModel();
  173. $type_info = $type_model->getSubjectTypeInfo([ [ 'type_id', '=', $type_id ] ]);
  174. return $type_info;
  175. }
  176. }
  177. /**举报类型编辑
  178. * @return mixed
  179. */
  180. public function editsubjecttype()
  181. {
  182. if (request()->isAjax()) {
  183. $type_id = input('type_id', 0);
  184. $data = [
  185. 'type_name' => input('type_name', ''),
  186. 'type_desc' => input('type_desc', ''),
  187. 'type_id' => $type_id,
  188. ];
  189. $subject_type_model = new InformSubjectTypeModel();
  190. return $subject_type_model->editSubjectType($data);
  191. }
  192. }
  193. /**举报主题详情
  194. * @return mixed
  195. */
  196. public function subjectinfo()
  197. {
  198. if (request()->isAjax()) {
  199. $subject_id = input('subject_id', '');
  200. $subject_model = new InformSubjectModel();
  201. $subject_info = $subject_model->getSubjectInfo([ [ 'subject_id', '=', $subject_id ] ]);
  202. $subjecttype_model = new InformSubjectTypeModel();
  203. $subjecttype = $subjecttype_model->getSubjectTypeList();
  204. $data = [
  205. 'typeid' => $subjecttype['data'],
  206. 'subject_type_id' => $subject_info['data']['subject_type_id'],
  207. 'subject_info' => $subject_info['data']['subject_content']
  208. ];
  209. return $data;
  210. }
  211. }
  212. /**举报主题编辑
  213. * @return mixed
  214. */
  215. public function editsubject()
  216. {
  217. if (request()->isAjax()) {
  218. $subject_id = input('subject_id', 0);
  219. $data = [
  220. 'subject_content' => input('subject_content', ''),
  221. 'subject_type_name' => input('subject_type_name', ''),
  222. 'subject_state' => input('subject_state', ''),
  223. 'subject_id' => $subject_id,
  224. ];
  225. $subject_type_model = new InformSubjectModel();
  226. return $subject_type_model->editSubject($data);
  227. }
  228. }
  229. /**
  230. * 举报处理
  231. */
  232. public function editinform()
  233. {
  234. if (request()->isAjax()) {
  235. $inform_id = input('inform_id', 0);
  236. $data = [
  237. 'state' => input('state', '1'),
  238. 'deal_time' => time(),
  239. 'deal_content' => input('deal_content', ''),
  240. 'inform_id' => $inform_id,
  241. ];
  242. $subject_type_model = new InformModel();
  243. return $subject_type_model->editInform($data);
  244. }
  245. }
  246. }