Payment.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | A3Mall
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2020 http://www.a3-mall.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Author: xzncit <158373108@qq.com>
  8. // +----------------------------------------------------------------------
  9. namespace app\admin\service\system;
  10. use app\admin\service\Service;
  11. use app\common\models\Payment as PaymentModel;
  12. class Payment extends Service {
  13. /**
  14. * 列表
  15. * @return array
  16. * @throws \think\db\exception\DataNotFoundException
  17. * @throws \think\db\exception\DbException
  18. * @throws \think\db\exception\ModelNotFoundException
  19. */
  20. public static function getList(){
  21. return PaymentModel::where('is_show',0)->select()->toArray();
  22. }
  23. /**
  24. * 详情
  25. * @param $id
  26. * @return array|\think\Model|null
  27. * @throws \think\db\exception\DataNotFoundException
  28. * @throws \think\db\exception\DbException
  29. * @throws \think\db\exception\ModelNotFoundException
  30. */
  31. public static function detail($id){
  32. $row = PaymentModel::where("id",$id)->where('is_show',0)->find();
  33. $row["config"] = !empty($row["config"]) ? json_decode($row["config"],true) : [];
  34. return $row;
  35. }
  36. /**
  37. * 保存数据
  38. * @param $data
  39. * @return bool
  40. */
  41. public static function save($data){
  42. $data['config'] = json_encode($data["config"]);
  43. PaymentModel::where("id",$data["id"])->update($data);
  44. return true;
  45. }
  46. /**
  47. * 更新字段值
  48. * @return PaymentModel
  49. */
  50. public static function setFields(){
  51. $data = self::getFields();
  52. return PaymentModel::where("id",$data["id"])->update([$data["name"]=>$data["value"]]);
  53. }
  54. }