edit修改排序和日期
This commit is contained in:
parent
b598053673
commit
471b22e329
@ -19,10 +19,10 @@ class Oss
|
|||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->accessKeyId = 'LTAI5tShVduri66gPQj1arLQ';
|
$this->accessKeyId = 'LTAI5tMaDbEbWyQWpwmxp24y';
|
||||||
$this->accessKeySecret = 'R9pzKpWbfcudFO7VrWSz3BZst62ayX';
|
$this->accessKeySecret = '3bjqbBFC08YIub3c8ry9Elz05UF1J7';
|
||||||
$this->bucket = 'cxgyc';
|
$this->bucket = 'cxgjyz';
|
||||||
$this->endpoint = 'https://oss-cn-guangzhou.aliyuncs.com';
|
$this->endpoint = 'https://oss-cn-beijing.aliyuncs.com';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!isset($this->client)) {
|
if (!isset($this->client)) {
|
||||||
|
|||||||
@ -17,6 +17,7 @@ use Yii;
|
|||||||
* @property int $is_delete 是否删除,0=否,1=是
|
* @property int $is_delete 是否删除,0=否,1=是
|
||||||
* @property int $deleted_at 删除时间
|
* @property int $deleted_at 删除时间
|
||||||
* @property string $notice 包厢公告
|
* @property string $notice 包厢公告
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
class Box extends \yii\db\ActiveRecord
|
class Box extends \yii\db\ActiveRecord
|
||||||
{
|
{
|
||||||
@ -35,7 +36,7 @@ class Box extends \yii\db\ActiveRecord
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[['goods_id', 'bj_id', 'notice', 'status', 'created_at'], 'required'],
|
[['goods_id', 'bj_id', 'notice', 'status', 'created_at'], 'required'],
|
||||||
[['goods_id', 'bj_id', 'status', 'created_at', 'updated_at', 'is_delete', 'deleted_at'], 'integer'],
|
[['goods_id', 'bj_id', 'status', 'created_at', 'updated_at', 'is_delete', 'deleted_at','sort'], 'integer'],
|
||||||
[['notice', 'cover_pic'], 'string'],
|
[['notice', 'cover_pic'], 'string'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,7 +46,7 @@ class GoodsHub extends \yii\db\ActiveRecord
|
|||||||
[['name', 'detail', 'cover_pic'], 'required'],
|
[['name', 'detail', 'cover_pic'], 'required'],
|
||||||
[['original_price', 'cost_price'], 'number'],
|
[['original_price', 'cost_price'], 'number'],
|
||||||
[['detail', 'pic_urls'], 'string'],
|
[['detail', 'pic_urls'], 'string'],
|
||||||
[['name', 'subtitle', 'cover_pic', 'video_url', 'unit'], 'string', 'max' => 255],
|
// [['name', 'subtitle', 'cover_pic', 'video_url', 'unit'], 'string', 'max' => 255],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -128,13 +128,13 @@ class CommonGoodsEditForm extends Model
|
|||||||
$this->model->virtual_sales = $this->virtual_sales;
|
$this->model->virtual_sales = $this->virtual_sales;
|
||||||
$this->model->confine_count = $this->confine_count;
|
$this->model->confine_count = $this->confine_count;
|
||||||
$this->model->freight_id = $this->freight_id;
|
$this->model->freight_id = $this->freight_id;
|
||||||
$this->model->sort = 100;
|
$this->model->sort = $this->sort;
|
||||||
$this->model->status = 1;
|
$this->model->status = 1;
|
||||||
// $this->handleAttrGroups();
|
// $this->handleAttrGroups();
|
||||||
// $this->model->attr_groups = json_encode($this->attrGroups,JSON_UNESCAPED_UNICODE);
|
// $this->model->attr_groups = json_encode($this->attrGroups,JSON_UNESCAPED_UNICODE);
|
||||||
$this->model->attr_groups = 1; //商品规格组 用不到看表 0 不需要规格组
|
$this->model->attr_groups = 1; //商品规格组 用不到看表 0 不需要规格组
|
||||||
|
|
||||||
$this->model->date = strtotime($this->date);
|
$this->model->date = (int)strtotime($this->date."-01-01");
|
||||||
|
|
||||||
|
|
||||||
//保存商品基础信息
|
//保存商品基础信息
|
||||||
|
|||||||
@ -84,7 +84,7 @@ class CommonGoodsListForm extends Model
|
|||||||
$query = $this->getQuery($cat_query);
|
$query = $this->getQuery($cat_query);
|
||||||
$query = $query->where([
|
$query = $query->where([
|
||||||
'g.cx_mch_id' => $this->cx_mch_id,
|
'g.cx_mch_id' => $this->cx_mch_id,
|
||||||
// 'g.is_delete' => 0,
|
'g.is_delete' => 0,
|
||||||
// 'gh.is_delete' => 0,
|
// 'gh.is_delete' => 0,
|
||||||
// 'g.plugin_sign' => $this->plugin_sign,
|
// 'g.plugin_sign' => $this->plugin_sign,
|
||||||
])
|
])
|
||||||
@ -111,7 +111,7 @@ class CommonGoodsListForm extends Model
|
|||||||
$count_query = clone $query;
|
$count_query = clone $query;
|
||||||
$count = $count_query->count();
|
$count = $count_query->count();
|
||||||
$pagination = new Pagination(['pageSize' => $this->limit, 'totalCount' => $count, 'page' => $this->page - 1]);
|
$pagination = new Pagination(['pageSize' => $this->limit, 'totalCount' => $count, 'page' => $this->page - 1]);
|
||||||
$list = $query->offset($pagination->offset)->limit($pagination->limit)->orderBy(['g.sort' => SORT_ASC, 'g.created_at' => SORT_DESC])->asArray()->all();
|
$list = $query->offset($pagination->offset)->limit($pagination->limit)->orderBy(['g.sort' => SORT_DESC, 'g.created_at' => SORT_DESC])->asArray()->all();
|
||||||
|
|
||||||
|
|
||||||
$list = $this->handleList($list);
|
$list = $this->handleList($list);
|
||||||
|
|||||||
@ -194,7 +194,7 @@ class GoodsController extends Controller
|
|||||||
|
|
||||||
$return_url = \Yii::$app->request->referrer;
|
$return_url = \Yii::$app->request->referrer;
|
||||||
|
|
||||||
$model->date = date('Y-m-d', $model->date);
|
$model->date = date('Y', $model->date);
|
||||||
|
|
||||||
// var_dump($model->goodsHub->video_url);
|
// var_dump($model->goodsHub->video_url);
|
||||||
// var_dump($model->goodsHub->video_banner_urls);
|
// var_dump($model->goodsHub->video_banner_urls);
|
||||||
|
|||||||
@ -40,13 +40,14 @@ class BoxEditForm extends AdminModel
|
|||||||
public $updated_at;
|
public $updated_at;
|
||||||
public $is_delete;
|
public $is_delete;
|
||||||
public $deleted_at;
|
public $deleted_at;
|
||||||
|
public $sort;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[['status', 'created_at', 'updated_at', 'is_delete', 'deleted_at', 'goods_id', 'bj_id'], 'integer'],
|
[['status', 'created_at', 'updated_at', 'is_delete', 'deleted_at', 'goods_id', 'bj_id','sort'], 'integer'],
|
||||||
[['model'], 'safe'],
|
[['model'], 'safe'],
|
||||||
[['notice', 'cover_pic'], 'string'],
|
[['notice', 'cover_pic'], 'string'],
|
||||||
[['goods_id', 'bj_id', 'notice', 'cover_pic'], 'required'],
|
[['goods_id', 'bj_id', 'notice', 'cover_pic'], 'required'],
|
||||||
@ -87,6 +88,7 @@ class BoxEditForm extends AdminModel
|
|||||||
$this->model->cover_pic = $this->cover_pic;
|
$this->model->cover_pic = $this->cover_pic;
|
||||||
$this->model->status = $this->status;
|
$this->model->status = $this->status;
|
||||||
$this->model->notice = $this->notice;
|
$this->model->notice = $this->notice;
|
||||||
|
$this->model->sort = $this->sort;
|
||||||
|
|
||||||
if (!$this->model->save()) {
|
if (!$this->model->save()) {
|
||||||
return $this->getModelError($this->model);
|
return $this->getModelError($this->model);
|
||||||
|
|||||||
@ -56,7 +56,7 @@ class BoxListForm extends AdminModel
|
|||||||
->leftJoin(['goods' => Goods::tableName()], 'b.goods_id=goods.id')
|
->leftJoin(['goods' => Goods::tableName()], 'b.goods_id=goods.id')
|
||||||
->leftJoin(['goodHub' => GoodsHub::tableName()], 'goods.goods_hub_id=goodHub.id')
|
->leftJoin(['goodHub' => GoodsHub::tableName()], 'goods.goods_hub_id=goodHub.id')
|
||||||
->leftJoin(['storeBj' => StoreBj::tableName()], 'b.bj_id=storeBj.id')
|
->leftJoin(['storeBj' => StoreBj::tableName()], 'b.bj_id=storeBj.id')
|
||||||
->select('b.id,b.created_at,b.status,goodHub.name as goods_name,storeBj.name as bj_name')
|
->select('b.id,b.created_at,b.status,goodHub.name as goods_name,storeBj.name as bj_name,b.sort')
|
||||||
->where([
|
->where([
|
||||||
'b.is_delete' => 0
|
'b.is_delete' => 0
|
||||||
])
|
])
|
||||||
@ -65,7 +65,7 @@ class BoxListForm extends AdminModel
|
|||||||
|
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
$pagination = new Pagination(['totalCount' => $count, 'pageSize' => $this->limit]);
|
$pagination = new Pagination(['totalCount' => $count, 'pageSize' => $this->limit]);
|
||||||
$list = $query->offset($pagination->offset)->limit($pagination->limit)->orderBy(['b.created_at' => SORT_DESC])->asArray()->all();
|
$list = $query->offset($pagination->offset)->limit($pagination->limit)->orderBy(['b.sort'=>SORT_DESC,'b.id' => SORT_DESC])->asArray()->all();
|
||||||
foreach ($list as $index => $item) {
|
foreach ($list as $index => $item) {
|
||||||
// $item['business'] = $item['begin_time'] . '-' . $item['end_time'];
|
// $item['business'] = $item['begin_time'] . '-' . $item['end_time'];
|
||||||
$item['created_at_cn'] = date("Y-m-d H:i", $item['created_at']);
|
$item['created_at_cn'] = date("Y-m-d H:i", $item['created_at']);
|
||||||
|
|||||||
@ -89,9 +89,18 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">排序</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="number" name="sort" placeholder="请输入数字" autocomplete="off"
|
||||||
|
class="layui-input" value="<?= $model->sort ? $model->sort : 100 ?>">
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid layui-word-aux">降序,值越大排序越靠前</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label ">多冠组合</label>
|
<label class="layui-form-label required">多冠组合</label>
|
||||||
<div class="layui-input-block" style="width: 200px">
|
<div class="layui-input-block" style="width: 200px">
|
||||||
<select name="cat3_id">
|
<select name="cat3_id">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
@ -119,8 +128,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label required">出生日期</label>
|
<label class="layui-form-label required">出生日期</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input type="date" name="date" placeholder="请输入出生日期" autocomplete="off"
|
<input type="text" name="date" class="layui-input" id="test2" placeholder="yyyy">
|
||||||
class="layui-input" value="<?= $model->date ?>" lay-verify="required">
|
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-mid layui-word-aux"></div>
|
<div class="layui-form-mid layui-word-aux"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -241,15 +249,22 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
base: '/statics/layuiadmin/' //静态资源所在路径
|
base: '/statics/layuiadmin/' //静态资源所在路径
|
||||||
}).extend({
|
}).extend({
|
||||||
index: 'lib/index' //主入口模块
|
index: 'lib/index' //主入口模块
|
||||||
}).use(['index', 'user'], function () {
|
}).use(['index', 'user','laydate'], function () {
|
||||||
var $ = layui.$
|
var $ = layui.$
|
||||||
, setter = layui.setter
|
, setter = layui.setter
|
||||||
, admin = layui.admin
|
, admin = layui.admin
|
||||||
, form = layui.form
|
, form = layui.form
|
||||||
, router = layui.router()
|
, router = layui.router()
|
||||||
|
, laydate = layui.laydate
|
||||||
, search = router.search;
|
, search = router.search;
|
||||||
|
|
||||||
form.render();
|
form.render();
|
||||||
|
//年选择器
|
||||||
|
laydate.render({
|
||||||
|
elem: '#test2'
|
||||||
|
,type: 'year'
|
||||||
|
,value: '<?= $model->date ?>'
|
||||||
|
});
|
||||||
//提交
|
//提交
|
||||||
var submitLock = false;
|
var submitLock = false;
|
||||||
form.on('submit(layui-form-submit)', function (obj) {
|
form.on('submit(layui-form-submit)', function (obj) {
|
||||||
|
|||||||
@ -318,6 +318,7 @@ $cat_id = \Yii::$app->request->get('cat_id');
|
|||||||
, {field: 'cat3_list', title: '多冠组合', width: 120, templet: '#catListTpl3'}
|
, {field: 'cat3_list', title: '多冠组合', width: 120, templet: '#catListTpl3'}
|
||||||
, {field: 'cat4_list', title: '交付权益', width: 120, templet: '#catListTpl4'}
|
, {field: 'cat4_list', title: '交付权益', width: 120, templet: '#catListTpl4'}
|
||||||
, {field: 'price', title: '签约价格', width: 100}
|
, {field: 'price', title: '签约价格', width: 100}
|
||||||
|
, {field: 'sort', title: '排序', width: 60}
|
||||||
, {field: 'date_at_cn', title: '出生日期', width: 120}
|
, {field: 'date_at_cn', title: '出生日期', width: 120}
|
||||||
|
|
||||||
// , {field: 'goods_stock', title: '库存', width: 100}
|
// , {field: 'goods_stock', title: '库存', width: 100}
|
||||||
@ -328,7 +329,7 @@ $cat_id = \Yii::$app->request->get('cat_id');
|
|||||||
// , {field: 'sales', title: '已售(虚拟+实际)', templet: '#salesTpl', width: 160}
|
// , {field: 'sales', title: '已售(虚拟+实际)', templet: '#salesTpl', width: 160}
|
||||||
, {field: 'status_cn', title: '状态', width: 120, templet: '#statusTpl'}
|
, {field: 'status_cn', title: '状态', width: 120, templet: '#statusTpl'}
|
||||||
, {field: 'created_at_cn', title: '添加时间', width: 180}
|
, {field: 'created_at_cn', title: '添加时间', width: 180}
|
||||||
, {title: '操作', fixed: 'right', toolbar: '#rowBarTpl'}
|
, {title: '操作', fixed: 'right', toolbar: '#rowBarTpl', width: 180}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
, url: '<?=\Yii::$app->urlManager->createUrl(['admin/mall/goods/index'])?>'
|
, url: '<?=\Yii::$app->urlManager->createUrl(['admin/mall/goods/index'])?>'
|
||||||
|
|||||||
@ -75,6 +75,13 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label required">案例排序</label>
|
||||||
|
<div class="layui-input-block" style="width: 200px;">
|
||||||
|
<input type="text" name="sort" class="layui-input" value="<?= $model->sort ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="layui-form-item" style="display: block">
|
<div class="layui-form-item" style="display: block">
|
||||||
<label class="layui-form-label required">案例状态</label>
|
<label class="layui-form-label required">案例状态</label>
|
||||||
|
|||||||
@ -143,11 +143,11 @@ $user_type = \Yii::$app->request->get('user_type');
|
|||||||
, {field: 'id', title: 'ID', width: 80}
|
, {field: 'id', title: 'ID', width: 80}
|
||||||
, {field: 'goods_name', title: '冠军名称'}
|
, {field: 'goods_name', title: '冠军名称'}
|
||||||
, {field: 'bj_name', title: '所属分类'}
|
, {field: 'bj_name', title: '所属分类'}
|
||||||
// , {field: 'money', title: '案例金额'}
|
|
||||||
// , {field: 'device', title: '案例设备'}
|
// , {field: 'device', title: '案例设备'}
|
||||||
// , {field: 'business', title: '营业时间', width: 110}
|
// , {field: 'business', title: '营业时间', width: 110}
|
||||||
, {field: 'status', title: '状态', templet: '#statusTpl', width: 80}
|
, {field: 'status', title: '状态', templet: '#statusTpl', width: 80}
|
||||||
, {field: 'created_at_cn', title: '创建时间', width: 150}
|
, {field: 'created_at_cn', title: '创建时间', width: 150}
|
||||||
|
, {field: 'sort', title: '案例排序'}
|
||||||
, {title: '操作', fixed: 'right', toolbar: '#rowBarTpl', width: 200}
|
, {title: '操作', fixed: 'right', toolbar: '#rowBarTpl', width: 200}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|||||||
@ -78,7 +78,7 @@ class GoodsController extends Controller
|
|||||||
$data = $form->search();
|
$data = $form->search();
|
||||||
|
|
||||||
foreach ($data['data'] as $key => $value) {
|
foreach ($data['data'] as $key => $value) {
|
||||||
$data['data'][$key]['date'] = date('Y-m-d', $value['date']);
|
$data['data'][$key]['date'] = date('Y', $value['date']);
|
||||||
// $data['data'][$key]['video_url'] = SiteHelper::getFullUrl($value['video_url']);
|
// $data['data'][$key]['video_url'] = SiteHelper::getFullUrl($value['video_url']);
|
||||||
$data['data'][$key]['pic_arr'] = [];
|
$data['data'][$key]['pic_arr'] = [];
|
||||||
if ($value['pic_urls'] != null) {
|
if ($value['pic_urls'] != null) {
|
||||||
@ -141,7 +141,7 @@ class GoodsController extends Controller
|
|||||||
$data = $form->search();
|
$data = $form->search();
|
||||||
|
|
||||||
foreach ($data['data'] as $key => $value) {
|
foreach ($data['data'] as $key => $value) {
|
||||||
$data['data'][$key]['date'] = date('Y-m-d', $value['date']);
|
$data['data'][$key]['date'] = date('Y', $value['date']);
|
||||||
$data['data'][$key]['pic_arr'] = [];
|
$data['data'][$key]['pic_arr'] = [];
|
||||||
if ($value['pic_urls'] != null) {
|
if ($value['pic_urls'] != null) {
|
||||||
$pic_arr = json_decode($value['pic_urls'], true);
|
$pic_arr = json_decode($value['pic_urls'], true);
|
||||||
|
|||||||
@ -71,7 +71,7 @@ class BoxForm extends ApiModel
|
|||||||
|
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
$pagination = new Pagination(['totalCount' => $count, 'pageSize' => $this->limit]);
|
$pagination = new Pagination(['totalCount' => $count, 'pageSize' => $this->limit]);
|
||||||
$list = $query->offset($pagination->offset)->limit($pagination->limit)->orderBy(['b.created_at' => SORT_DESC])->asArray()->all();
|
$list = $query->offset($pagination->offset)->limit($pagination->limit)->orderBy(['b.sort'=>SORT_DESC,'b.id' => SORT_DESC])->asArray()->all();
|
||||||
foreach ($list as $index => $item) {
|
foreach ($list as $index => $item) {
|
||||||
// $item['business'] = $item['begin_time'] . '-' . $item['end_time'];
|
// $item['business'] = $item['begin_time'] . '-' . $item['end_time'];
|
||||||
$list[$index]['created_at_cn'] = date("Y-m-d H:i", $item['created_at']);
|
$list[$index]['created_at_cn'] = date("Y-m-d H:i", $item['created_at']);
|
||||||
|
|||||||
BIN
vendor.rar
BIN
vendor.rar
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user