SupplyDemandLogic.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\adminapi\logic\agricultural_machinery;
  15. use app\common\enum\PayEnum;
  16. use app\common\enum\YesNoEnum;
  17. use app\common\logic\BaseLogic;
  18. use app\common\model\agricultural_machinery\UserService;
  19. use app\common\model\article\ArticleCate;
  20. use app\common\model\user\User;
  21. use app\common\model\agricultural_machinery\ServiceCategory as AgriculturalMachineryServiceCategory;
  22. use app\common\model\supply_demand\SupplyDemandInfo;
  23. use app\common\model\recharge\RechargeOrder;
  24. use app\common\model\ServiceCharge;
  25. use think\facade\Db;
  26. /**
  27. * 供需管理逻辑
  28. * Class ArticleCateLogic
  29. * @package app\adminapi\logic\article
  30. */
  31. class SupplyDemandLogic extends BaseLogic
  32. {
  33. /**
  34. * @notes 删除农耕分类
  35. * @param array $params
  36. * @author heshihu
  37. * @date 2022/2/21 17:52
  38. */
  39. public static function delete(array $params)
  40. {
  41. UserService::destroy($params['id']);
  42. }
  43. /**
  44. * @notes 查看供需详情
  45. * @param $params
  46. * @return array
  47. * @author heshihu
  48. * @date 2022/2/21 17:54
  49. */
  50. public static function detail($params) : array
  51. {
  52. return SupplyDemandInfo::findOrEmpty($params['id'])->toArray();
  53. }
  54. /**
  55. * @notes 更改服务商状态
  56. * @param array $params
  57. * @return bool
  58. * @author heshihu
  59. * @date 2022/2/21 18:04
  60. */
  61. public static function updateStatus(array $params)
  62. {
  63. SupplyDemandInfo::update([
  64. 'id' => $params['id'],
  65. 'status' => $params['status'],
  66. 'audit_time' =>time(),
  67. 'remark' => $params['remark']
  68. ]);
  69. return true;
  70. }
  71. /**
  72. * @notes 有效用户数据
  73. * @return array
  74. * @throws \think\db\exception\DataNotFoundException
  75. * @throws \think\db\exception\DbException
  76. * @throws \think\db\exception\ModelNotFoundException
  77. * @author 段誉
  78. * @date 2022/10/13 10:53
  79. */
  80. public static function getValidUserData()
  81. {
  82. $list = User::where(['is_disable' => YesNoEnum::NO])
  83. ->field('id,sn,nickname')
  84. ->order([ 'id' => 'desc'])
  85. ->select()
  86. ->toArray();
  87. return $list;
  88. }
  89. }