12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
- namespace app\common\model;
- use think\Model;
- /**
- * 短信验证码
- */
- class Refund Extends Model
- {
- protected $name='order_info_refund';
- const REFUND_ING=10;
- const REFUND_PASS=20;
- const REFUND_REJECT=30;
- const REFUND_CANCEL=40;
- public static $refundStatus=[
- self::REFUND_ING=>'申请处理中',
- self::REFUND_PASS=>'申请通过',
- self::REFUND_REJECT=>'申请驳回',
- self::REFUND_CANCEL=>'已取消',
- ];
- /**
- * @return string[]
- */
- public static function getRefundStatus(): array
- {
- return self::$refundStatus;
- }
- const REFUND_TYPE_MONEY=1;
- const REFUND_TYPE_ALL=2;
- const REFUND_TYPE_GOODS=3;
- public static $refundTypes=[
- self::REFUND_TYPE_MONEY=>'退款',
- self::REFUND_TYPE_ALL=>'退款退货',
- self::REFUND_TYPE_GOODS=>'仅退货',
- ];
- /**
- * @return string[]
- */
- public static function getRefundTypes(): array
- {
- return self::$refundTypes;
- }
- protected $autoWriteTimestamp=true;
- public function allowCancel(){
- return in_array($this['refund_status'],[
- self::REFUND_ING,
- ]);
- }
- public function makeCancel(){
- $this['refund_status']=self::REFUND_CANCEL;
- $this->save();
- OrderInfo::where('id',$this['order_info_id'])->update([
- 'refund_id'=>null,
- ]);
- }
- public function allowAudit(){
- return $this['refund_status']==self::REFUND_ING;
- }
- public function makeAudit($pass){
- if($pass){
- }else{
- }
- }
- protected static function init()
- {
- self::beforeInsert(function (self $refund){
- $refund['refund_status']=self::REFUND_ING;
- });
- }
- }
|