init commit
This commit is contained in:
40
application/admin/model/wdsxh/points/Express.php
Normal file
40
application/admin/model/wdsxh/points/Express.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\wdsxh\points;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Express extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'wdsxh_points_express';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
57
application/admin/model/wdsxh/points/Goods.php
Normal file
57
application/admin/model/wdsxh/points/Goods.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\wdsxh\points;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class Goods extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'wdsxh_points_goods';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text'
|
||||
];
|
||||
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
self::afterInsert(function ($row) {
|
||||
$pk = $row->getPk();
|
||||
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['normal' => __('Status normal'), 'hidden' => __('Status hidden')];
|
||||
}
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
23
application/admin/model/wdsxh/points/Logistics.php
Normal file
23
application/admin/model/wdsxh/points/Logistics.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 麦沃德科技赋能开发者,助力中小企业发展
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2017~2024 www.wdadmin.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Wdadmin系统产品软件并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: MY WORLD Team <bd@maiwd.cn> www.wdadmin.cn
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\admin\model\wdsxh\points;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Logistics extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'wdsxh_points_order_logistics';
|
||||
|
||||
protected $type = [
|
||||
'send_time' => 'timestamp:Y-m-d H:i:s',
|
||||
];
|
||||
}
|
||||
84
application/admin/model/wdsxh/points/Order.php
Normal file
84
application/admin/model/wdsxh/points/Order.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\wdsxh\points;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Order extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'wdsxh_points_order';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'state_text',
|
||||
'complete_time_text',
|
||||
'redemption_time_text',
|
||||
'goods_info',
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getStateList()
|
||||
{
|
||||
return ['2' => __('State 2'), '3' => __('State 3'), '4' => __('State 4')];
|
||||
}
|
||||
|
||||
|
||||
public function getStateTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['state']) ? $data['state'] : '');
|
||||
$list = $this->getStateList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getCompleteTimeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['complete_time']) ? $data['complete_time'] : '');
|
||||
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||
}
|
||||
|
||||
|
||||
public function getRedemptionTimeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['redemption_time']) ? $data['redemption_time'] : '');
|
||||
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||
}
|
||||
|
||||
protected function setCompleteTimeAttr($value)
|
||||
{
|
||||
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
||||
}
|
||||
|
||||
protected function setRedemptionTimeAttr($value)
|
||||
{
|
||||
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
||||
}
|
||||
|
||||
public function getGoodsInfoAttr($value, $data)
|
||||
{
|
||||
$goods = (new Goods())
|
||||
->withTrashed()
|
||||
->where('id',$data['goods_id'])
|
||||
->field('name,image')
|
||||
->find();
|
||||
$goods->points = $data['points'];
|
||||
return $goods;
|
||||
}
|
||||
|
||||
}
|
||||
36
application/admin/model/wdsxh/points/PointsConfig.php
Normal file
36
application/admin/model/wdsxh/points/PointsConfig.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 麦沃德科技赋能开发者,助力商协会发展
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
// +----------------------------------------------------------------------
|
||||
/**
|
||||
* Class PointsConfig
|
||||
* Desc 积分配置Model
|
||||
* Create on 2025/11/14
|
||||
*/
|
||||
|
||||
namespace app\admin\model\wdsxh\points;
|
||||
|
||||
|
||||
use think\Model;
|
||||
|
||||
class PointsConfig extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'wdsxh_points_config';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
|
||||
}
|
||||
|
||||
|
||||
40
application/admin/model/wdsxh/points/Ranking.php
Normal file
40
application/admin/model/wdsxh/points/Ranking.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\wdsxh\points;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Ranking extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'wdsxh_user_wechat_points_log';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
49
application/admin/model/wdsxh/points/UserWechatPointsLog.php
Normal file
49
application/admin/model/wdsxh/points/UserWechatPointsLog.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\wdsxh\points;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class UserWechatPointsLog extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'wdsxh_user_wechat_points_log';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'change_text'
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getChangeList()
|
||||
{
|
||||
return ['1' => __('Change 1'), '2' => __('Change 2')];
|
||||
}
|
||||
|
||||
|
||||
public function getChangeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['change']) ? $data['change'] : '');
|
||||
$list = $this->getChangeList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user