Apply.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. namespace addons\Alitopay\common\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "{{%addons_atp_apply}}".
  6. *
  7. * @property int $id
  8. * @property string|null $deal_sn 单号
  9. * @property int|null $mall_id
  10. * @property string $alipay_app_id 支付宝应用ID
  11. * @property string $company 公司名称
  12. * @property string $contacts 联系人
  13. * @property string $phone 电话
  14. * @property int $status 1审核中 2审核成功 3审查失败
  15. * @property int $is_delete 是否删除
  16. * @property int $created_at 创建时间
  17. * @property int $updated_at 更新时间
  18. * @property string $reason 理由
  19. * @property string|null $auth_url 授权url
  20. * @property int $auth_status 1 授权中 2授权通过
  21. * @property int|null $auth_time 授权时间
  22. * @property int|null $auth_expires_time 授权过期时间
  23. */
  24. class Apply extends \yii\db\ActiveRecord
  25. {
  26. public static $status_text = [
  27. 1=>'审核中',
  28. 2=>'审核成功',
  29. 3=>'审核失败'
  30. ];
  31. public static $auth_status_text = [
  32. 1=>'授权中',
  33. 2=>'授权成功',
  34. ];
  35. /**
  36. * {@inheritdoc}
  37. */
  38. public static function tableName()
  39. {
  40. return '{{%addons_atp_apply}}';
  41. }
  42. /**
  43. * {@inheritdoc}
  44. */
  45. public function rules()
  46. {
  47. return [
  48. [['mall_id', 'status', 'is_delete', 'created_at', 'updated_at', 'auth_status', 'auth_time', 'auth_expires_time'], 'integer'],
  49. [['alipay_app_id', 'company', 'contacts', 'phone'], 'required'],
  50. [['auth_url'], 'string'],
  51. [['deal_sn', 'alipay_app_id'], 'string', 'max' => 64],
  52. [['company', 'contacts', 'reason'], 'string', 'max' => 255],
  53. [['phone'], 'string', 'max' => 11],
  54. ];
  55. }
  56. /**
  57. * {@inheritdoc}
  58. */
  59. public function attributeLabels()
  60. {
  61. return [
  62. 'id' => 'ID',
  63. 'deal_sn' => '单号',
  64. 'mall_id' => 'Mall ID',
  65. 'alipay_app_id' => '支付宝应用ID',
  66. 'company' => '公司名称',
  67. 'contacts' => '联系人',
  68. 'phone' => '电话',
  69. 'status' => '1审核中 2审核成功 3审查失败 ',
  70. 'is_delete' => '是否删除',
  71. 'created_at' => '创建时间',
  72. 'updated_at' => '更新时间',
  73. 'reason' => '理由',
  74. 'auth_url' => '授权url',
  75. 'auth_status' => '1 授权中 2授权通过',
  76. 'auth_time' => '授权时间',
  77. 'auth_expires_time' => '授权过期时间',
  78. ];
  79. }
  80. public function getStatusText(){
  81. return self::$status_text[$this->status] ?? '';
  82. }
  83. public function getAuthStatusText(){
  84. return self::$auth_status_text[$this->auth_status] ?? '';
  85. }
  86. }