QaReply.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. *
  4. * @author: xaboy<365615158@qq.com>
  5. * @day: 2017/11/02
  6. */
  7. namespace app\admin\model\qa;
  8. use app\admin\model\store\StoreProduct;
  9. use app\admin\model\system\SystemAdmin;
  10. use app\models\user\User;
  11. use crmeb\traits\ModelTrait;
  12. use crmeb\basic\BaseModel;
  13. /**
  14. * 图文管理 Model
  15. * Class WechatNews
  16. * @package app\admin\model\wechat
  17. */
  18. class QaReply extends BaseModel
  19. {
  20. use ModelTrait;
  21. protected $name = 'qa_reply';
  22. /**
  23. * 获取回复列表
  24. * @param array $where
  25. * @return array
  26. */
  27. public static function getAll( $where = [],$id)
  28. {
  29. $model = new self;
  30. // if($where['status'] !== '') $model = $model->where('status',$where['status']);
  31. // if($where['access'] !== '') $model = $model->where('access',$where['access']);
  32. if ($where['title'] !== '') $model = $model->where('title', 'LIKE', "%$where[title]%");
  33. $model = $model->where('is_del', 0)->where('pid',$id)->order('id desc');
  34. return self::page($model, function ($item) {
  35. $item['nickname'] = User::where('uid', $item['uid'])->value('nickname');
  36. }, $where);
  37. }
  38. /**
  39. * 删除问答
  40. * @param $id
  41. * @return bool
  42. */
  43. public static function del($id)
  44. {
  45. return self::edit(['is_del' => 1], $id, 'id');
  46. }
  47. public static function changeFail($id)
  48. {
  49. return self::edit(['status' => 2], $id, 'id');
  50. }
  51. public static function changeSuccess($id)
  52. {
  53. return self::edit(['status' => 1], $id, 'id');
  54. }
  55. }