作者 郭宇鹏
1 个管道 的构建 通过 耗费 1 秒

'0041'

... ... @@ -121,13 +121,29 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Qr_code')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-qr_code" class="form-control" name="row[qr_code]" type="text">
<div class="input-group">
<input id="c-qr_code" class="form-control" size="50" name="row[qr_code]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-qr_code" class="btn btn-danger faupload" data-input-id="c-qr_code" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-qr_code"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-qr_code" class="btn btn-primary fachoose" data-input-id="c-qr_code" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-qr_code"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-qr_code"></ul>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Qr_code_d')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-qr_code_d" class="form-control" name="row[qr_code_d]" type="text">
<div class="input-group">
<input id="c-qr_code_d" class="form-control" size="50" name="row[image]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-qr_code_d" class="btn btn-danger faupload" data-input-id="c-qr_code_d" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-qr_code_d"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-qr_code_d" class="btn btn-primary fachoose" data-input-id="c-qr_code_d" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-qr_code_d"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-qr_code_d"></ul>
</div>
</div>
<div class="form-group">
... ...
... ... @@ -121,13 +121,35 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Qr_code')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-qr_code" class="form-control" name="row[qr_code]" type="text" value="{$row.qr_code|htmlentities}">
<div class="input-group">
<input id="c-qr_code" class="form-control" size="50" name="row[qr_code]" type="text" value="{$row.qr_code|htmlentities}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-qr_code" class="btn btn-danger faupload" data-input-id="c-qr_code" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-qr_code"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-qr_code" class="btn btn-primary fachoose" data-input-id="c-qr_code" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-qr_code"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-qr_code"></ul>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Qr_code')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-qr_code" class="form-control" name="row[qr_code]" type="text" value="{$row.qr_code|htmlentities}">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Qr_code_d')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-qr_code_d" class="form-control" name="row[qr_code_d]" type="text" value="{$row.qr_code_d|htmlentities}">
<div class="input-group">
<input id="c-qr_code_d" class="form-control" size="50" name="row[qr_code_d]" type="text" value="{$row.qr_code_d|htmlentities}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-qr_code_d" class="btn btn-danger faupload" data-input-id="c-qr_code_d" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-qr_code_d"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-qr_code_d" class="btn btn-primary fachoose" data-input-id="c-qr_code_d" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-qr_code_d"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-qr_code_d"></ul>
</div>
</div>
<div class="form-group">
... ...
... ... @@ -94,9 +94,15 @@ class Treasured extends BaseApi
if ($this->auth->authlist == '' || $this->auth->authlist == ','){
$this->error('请您先实名认证');
}
if ($this->auth->avatar != '' && !in_array(substr($this->auth->avatar,-4),explode(',','jpg,png,bmp,jpeg,gif,zip,rar,xls,xlsx'))){
$content = file_get_contents($this->auth->avatar);
file_put_contents(ROOT_PATH.'/public/uploads/user_avatar/user_id_'.$this->auth->id.'.jpg', $content);
model('user')->where('id',$this->auth->id)->update(['avatar'=>'/public/uploads/user_avatar/user_id_'.$this->auth->id.'.jpg']);
}
//2.获取数据
$data = $this->get_data_array([
['url','域名不能为空'],
['author','作者名称不能为空'],
['title','作品标题不能为空'],
['content','内容不存在'],
['images','图片必须上传'],
... ... @@ -122,6 +128,7 @@ class Treasured extends BaseApi
$data['avatar'] = $this->auth->avatar;
$data['nickname'] = $this->auth->nickname;
$data['images'] = $images;
$data['number'] = time()-mt_rand(1000,9999);
if (isset($data['url'])){
$url = $data['url'];
unset($data['url']);
... ... @@ -135,17 +142,21 @@ class Treasured extends BaseApi
if ($qr_code_bg && !empty($qr_code_bg['value'])){
$code = new QRcode();
$qr_code = $code->png($url.$treasured['id']) //生成二维码
->logo(ROOT_PATH.'public/assets/img/bg.png',4,1.97) //生成logo二维码
->logo($this->auth->avatar)//生成logo二维码
->getPath();//获取二维码生成的地址
->logo(ROOT_PATH.'public/assets/img/bg.png',4,1.97); //生成logo二维码
if (!empty($this->auth->avatar)){
$qr_code = $qr_code->logo($this->auth->avatar);//生成logo二维码
}
$qr_code = $qr_code->getPath();//获取二维码生成的地址
$qr_code_d = $code->png($url.$treasured['id']) //生成二维码
->logo(ROOT_PATH.'public/assets/img/bg.png',4,1.97) //生成logo二维码
->logo($this->auth->avatar)//生成logo二维码
->background(550,950,cdnurl($qr_code_bg['value'])) //给二维码加上背景
->logo(ROOT_PATH.'public/assets/img/bg.png',4,1.97); //生成logo二维码
if (!empty($this->auth->avatar)){
$qr_code_d = $qr_code_d->logo($this->auth->avatar);//生成logo二维码
}
$qr_code_d = $qr_code_d->background(550,950,cdnurl($qr_code_bg['value'])) //给二维码加上背景
->getPath();//获取二维码生成的地址
//8.更新数据
$treasured->qr_code = this_url().$qr_code;
$treasured->qr_code_d = this_url().$qr_code_d;
$treasured->qr_code = $qr_code;
$treasured->qr_code_d = $qr_code_d;
$treasured->save();
}
//9.返回结果
... ...
... ... @@ -126,7 +126,7 @@ class User extends Model
//$value = '/assets/img/avatar.png';
$value = letter_avatar($data['nickname']);
}
return $value;
return cdnurl($value,true);
}
/**
... ...
... ... @@ -26,7 +26,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'user_id', title: __('User_id')},
//{field: 'user_id', title: __('User_id')},
{field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
{field: 'title', title: __('Title'), operate: 'LIKE'},
... ... @@ -35,16 +35,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
{field: 'content', title: __('Content'), operate: 'LIKE'},
{field: 'production_typeface', title: __('Production_typeface'), operate: 'LIKE'},
{field: 'production_typeface_id', title: __('Production_typeface_id')},
//{field: 'production_typeface_id', title: __('Production_typeface_id')},
{field: 'production_format', title: __('Production_format'), operate: 'LIKE'},
{field: 'production_format_id', title: __('Production_format_id')},
//{field: 'production_format_id', title: __('Production_format_id')},
{field: 'treasured_size', title: __('Treasured_size'), operate: 'LIKE'},
{field: 'treasured_size_id', title: __('Treasured_size_id')},
//{field: 'treasured_size_id', title: __('Treasured_size_id')},
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
{field: 'zan_num', title: __('Zan_num')},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'qr_code', title: __('Qr_code'), operate: 'LIKE'},
{field: 'qr_code_d', title: __('Qr_code_d'), operate: 'LIKE'},
// {field: 'qr_code', title: __('Qr_code'), operate: 'LIKE',formatter: Table.api.formatter.image},
// {field: 'qr_code_d', title: __('Qr_code_d'), operate: 'LIKE',formatter: Table.api.formatter.image},
{field: 'is_audit', title: __('Is_audit'), searchList: {"0":__('Is_audit 0'),"1":__('Is_audit 1'),"2":__('Is_audit 2')}, formatter: Table.api.formatter.normal},
{field: 'audit_message', title: __('Audit_message'), operate: 'LIKE'},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
... ...