WechatMinAppPayOrder.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * Name: 芸众商城系统
  5. * Author: 广州市芸众信息科技有限公司
  6. * Profile: 广州市芸众信息科技有限公司位于国际商贸中心的广州,专注于移动电子商务生态系统打造,拥有芸众社交电商系统、区块链数字资产管理系统、供应链管理系统、电子合同等产品/服务。官网 :www.yunzmall.com www.yunzshop.com
  7. * Date: 2022/8/24
  8. * Time: 17:04
  9. */
  10. namespace app\common\models;
  11. class WechatMinAppPayOrder extends BaseModel
  12. {
  13. protected $table = 'yz_min_app_pay_manage_order';
  14. protected $guarded = [''];
  15. protected $casts = [
  16. 'notice_params' => 'json',
  17. ];
  18. protected $attributes = [
  19. 'status' => 0,
  20. ];
  21. /**
  22. * @param $trade_no
  23. * @return WechatMinAppPayOrder
  24. */
  25. public static function existOrNew($trade_no)
  26. {
  27. $model = self::where('trade_no',$trade_no)->first();
  28. if (is_null($model)) {
  29. $model = new self(['uniacid' => \YunShop::app()->uniacid]);
  30. }
  31. return $model;
  32. }
  33. public function getPayTimeStrAttribute()
  34. {
  35. return $this->pay_time?date('Y-m-d H:i:s', $this->pay_time) : '';
  36. }
  37. public function getStatusNameAttribute()
  38. {
  39. switch ($this->status) {
  40. case 1:
  41. $status_name = '待分账';
  42. break;
  43. case 2:
  44. $status_name = '已分账';
  45. break;
  46. default:
  47. $status_name = '未支付';
  48. }
  49. return $status_name;
  50. }
  51. }