12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- /**
- * GiftcodeModel.php UTF-8
- * 礼包码页面
- *
- * @date : 2017/11/18 17:11
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : wuyonghong <wyh@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace huo\model\game;
- use huo\model\common\CommonModel;
- class GiftcodeModel extends CommonModel {
- protected $name = 'gift_code';
- //设置只读字段
- protected $readonly = ['gift_id', 'code', 'create_time'];
- // 开启自动写入时间戳字段
- protected $autoWriteTimestamp = true;
- //类型转换
- protected $type
- = [
- 'gift_id' => 'integer',
- 'mem_id' => 'integer'
- ];
- //模型关联方法
- protected $relationFilter = ['member', 'gift'];
- /**
- * 关联 member 表
- *
- * @return \think\model\relation\BelongsTo
- */
- public function member() {
- return $this->belongsTo('huo\model\member\MemberModel', 'mem_id');
- }
- /**
- * 关联 gift 表
- *
- */
- public function gift() {
- return $this->belongsTo('huo\model\game\GiftModel', 'gift_id', 'id',[], 'left')->setEagerlyType(0);
- }
- }
|