Browse Source

checkredis

yuenan
娄梦宁 3 years ago
parent
commit
730ad253ee
5 changed files with 66 additions and 7 deletions
  1. +7
    -3
      addons/unishop/controller/Product.php
  2. +8
    -0
      addons/unishop/model/Product.php
  3. +20
    -2
      application/admin/view/unishop/product/add.html
  4. +20
    -2
      application/admin/view/unishop/product/edit.html
  5. +11
    -0
      public/assets/js/backend/unishop/product.js

+ 7
- 3
addons/unishop/controller/Product.php View File

@@ -20,12 +20,14 @@ class Product extends Base
public function detail()
{
$productId = $this->request->get('id');
$productId = \addons\unishop\extend\Hashids::decodeHex($productId);

if (!is_numeric($productId)){
$productId = \addons\unishop\extend\Hashids::decodeHex($productId);
}
try {

$productModel = new productModel();
$data = $productModel->where(['id' => $productId])->cache(10)->find();

if (!$data) {
$this->error(__('Goods not exist'));
}
@@ -78,7 +80,9 @@ class Product extends Base
if ($evaluate) {
$data->evaluate_list = collection($evaluate)->append(['createtime_text'])->toArray();
}
$data = $data->append(['images_text', 'spec_list', 'spec_table_list'])->toArray();
$data = $data->append(['images_text', "detail_images_text",'spec_list', 'spec_table_list'])->toArray();
print_r($data);
die();
$this->success('', $data);
} catch (Exception $e) {
$this->error($e->getMessage());


+ 8
- 0
addons/unishop/model/Product.php View File

@@ -103,6 +103,14 @@ class Product extends Model
return $images;
}

public function getDetailImagesTextAttr($value, $data){
$images = explode(',', $data['detail_images']);
foreach ($images as &$image) {
$image = Config::getImagesFullUrl($image);
}
return $images;
}

/**
* 处理规格属性
* @param $value


+ 20
- 2
application/admin/view/unishop/product/add.html View File

@@ -39,7 +39,7 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('轮播图片')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text">
@@ -57,7 +57,25 @@
<ul class="row list-inline plupload-preview" id="p-images"></ul>
</div>
</div>

<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('详情图片')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-detail_images" data-rule="required" class="form-control" size="50" name="row[detail_images]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-detail_images" class="btn btn-danger plupload"
data-input-id="c-detail_images"
data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp"
data-multiple="true" data-preview-id="p-detail_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-detail_images" class="btn btn-primary fachoose"
data-input-id="c-detail_images" data-mimetype="image/*" data-multiple="true"><i
class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-detail_images"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-detail_images"></ul>
</div>
</div>
<style>
table tr td, table tr th {
border-right: 1px solid #f1f1f1;


+ 20
- 2
application/admin/view/unishop/product/edit.html View File

@@ -37,7 +37,7 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('轮播图片')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text" value="{$row.images}">
@@ -55,7 +55,25 @@
<ul class="row list-inline plupload-preview" id="p-images"></ul>
</div>
</div>

<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('详情图片')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-detail_images" data-rule="required" class="form-control" size="50" name="row[detail_images]" value="{$row.detail_images}" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-detail_images" class="btn btn-danger plupload"
data-input-id="c-detail_images"
data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp"
data-multiple="true" data-preview-id="p-detail_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-detail_images" class="btn btn-primary fachoose"
data-input-id="c-detail_images" data-mimetype="image/*" data-multiple="true"><i
class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-detail_images"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-detail_images"></ul>
</div>
</div>
<style>
table tr td, table tr th {
border-right: 1px solid #f1f1f1;


+ 11
- 0
public/assets/js/backend/unishop/product.js View File

@@ -581,6 +581,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'upload', 'plupload',
events: Table.api.events.operate,
formatter: Table.api.formatter.operate,
buttons:[
// {
// name: 'preview',
// text: __('预览'),
// classname: 'btn btn-xs btn-info',
// extend: 'data-toggle="tooltip"',
// icon: 'fa fa-commenting',
// click: function (row) {
// alert(11);
// window.location.href='http://47.101.187.29:8083/h5/#/pages/product/product?flash=0&id='+row.id
// }
// },
{
name: 'evaluate',
text: __('Evaluate'),


Loading…
Cancel
Save