1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- namespace app\models;
- use Yii;
- /**
- * This is the model class for table "order_return".
- *
- * @property int $id
- * @property string|null $deliveryid
- * @property string|null $website
- * @property string|null $customer
- * @property string|null $delivery
- * @property string|null $origin_goodsinfo
- * @property string|null $goodsinfo
- * @property string|null $usage
- * @property string|null $receiptdate
- * @property int|null $num
- * @property string|null $mark
- */
- class Orderreturn extends \yii\db\ActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'order_return';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [[ 'num','shop'], 'integer'],
- [['imgs'], 'safe'],
- [['imgs'], 'string', 'max' => 255],
- [['deliveryid', 'website', 'customer', 'receiptdate','delivery', 'origin_goodsinfo', 'goodsinfo', 'usage', 'mark'], 'string', 'max' => 255],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'deliveryid' => '收到单号',
- 'website' => '网站',
- 'customer' => '客户',
- 'delivery' => '货运',
- 'origin_goodsinfo' => '原订单货物详情',
- 'goodsinfo' => '货物详情',
- 'usage' => '完好程度',
- 'receiptdate' => '收货日期',
- 'num' => '当天序号',
- 'mark' => '备注',
- 'shop'=>'店铺'
- ];
- }
- public function afterFind(){
- parent::afterFind();
- $this->receiptdate=date('Y-m-d',$this->receiptdate);
- }
- public function beforeValidate(){
- is_array($this->imgs) && $this->imgs && $this->imgs = implode(',', $this->imgs);
- return $this;
- }
- public function beforeSave($options = array()){
- parent::beforeSave($options);
- $this->receiptdate=strtotime(trim($this->receiptdate));
- if(empty($this->created_at)){
- $this->created_at=time();
- }
- return $this;
- }
-
- }
|