接口、后台修改5

This commit is contained in:
彭桃 2023-02-11 11:42:42 +08:00
parent 7854e0b1b7
commit eef5e6b3d1
5 changed files with 151 additions and 2 deletions

View File

@ -156,6 +156,15 @@ class Products extends BaseController
$id = isset($param['id']) ? $param['id'] : 0;
$detail = Db::table('cms_agriculture_products')->where('id',$id)->find();
if (!empty($detail)) {
if($detail){
$maturity = Db::table('cms_agriculture_products_traceability')->where('szxc_planting_type_id',$detail['szxc_planting_type_id'])->value('content');
if($maturity){
$maturity = json_decode($maturity,1);
}else{
$maturity = '';
}
$detail['maturity'] = $maturity;
}
View::assign('detail', $detail);
$szxc_planting_type = Db::table('fa_szxc_planting_type')->select();
View::assign('szxc_planting_type', $szxc_planting_type);

View File

@ -67,6 +67,8 @@
function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
var editor = layui.tinymce;
var lat = "{$detail.lat}";
var lng = "{$detail.lng}";
var edit = editor.render({
selector: "#container_content",
height: 500
@ -99,6 +101,8 @@
created: function () { //可选项,地图被创建后回调
},
});
$('.lng').text(lng);
$('.lat').text(lat);
//监听提交
form.on('submit(webform)', function (data) {
data.field.lng = $('.lng').text();

View File

@ -40,6 +40,18 @@
</td>
</tr>
<tr>
<td class="layui-td-gray">成熟周期</td>
<td colspan="6">
{volist name='detail.maturity' id='vo'}
<p><img src="{$vo.pic}" alt="">
{$vo.name}
{$vo.zhouqi}周
</p>
{/volist}
</td>
</tr>
</table>
</div>
{/block}

View File

@ -67,6 +67,8 @@
function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
var editor = layui.tinymce;
var lat = "{$detail.lat}";
var lng = "{$detail.lng}";
var edit = editor.render({
selector: "#container_content",
height: 500
@ -99,6 +101,8 @@
created: function () { //可选项,地图被创建后回调
},
});
$('.lng').text(lng);
$('.lat').text(lat);
//监听提交
form.on('submit(webform)', function (data) {
data.field.lng = $('.lng').text();

View File

@ -713,8 +713,14 @@ class Statistics extends BaseController
// 录入商户
$return['shanghu'] = Db::connect('shop')->table('eb_merchant')->alias('a')->join('eb_merchant_address b','a.mer_id = b.mer_id')->where($where)->where($map)->count();
// 总订单
$return['total_order'] = Db::connect('shop')->table('eb_product_order_log')->where($where)->where('status',1)->count();
// 商品销量前十
$return['total_order'] = Db::connect('shop')->table('eb_product_order_log')->where('status',1)->count();
// 镇订单
$z_order = Db::connect('shop')->table('eb_product_order_log')->where($where)->where('status',1)->count();
// 镇分佣
$return['fenyong'] = 0;
//总市场流量
$return['liuliang'] = bcmul(bcdiv($z_order,$return['total_order'],2),100);
// 商品销量前十
$return['data'] = Db::connect('shop')->table('eb_store_product')
->alias('a')
->join('eb_product_order_log b','a.product_id = b.product_id')
@ -725,6 +731,7 @@ class Statistics extends BaseController
->group('a.product_id')
->order('value desc')
->select();
$this->apiSuccess('获取成功',$return);
}
@ -927,5 +934,118 @@ class Statistics extends BaseController
}
//养殖户数
public function get_num22($area_id=0,$street_id=0,$village_id=0){
$where = [];
if ($area_id){
$where[] = ['area_id', '=', $area_id];
}
if ($street_id){
$where[] = ['street_id', '=', $street_id];
}
if ($village_id){
$where[] = ['village_id', '=', $village_id];
}
$return = [
['value'=>50,'name'=>'养鸡'],
['value'=>48,'name'=>'养鸭'],
['value'=>28,'name'=>'养鹅'],
['value'=>10,'name'=>'养羊'],
['value'=>8,'name'=>'养虾'],
['value'=>30,'name'=>'养鱼'],
];
$this->apiSuccess('获取成功',$return);
}
//养殖户销量分析
public function get_num23($area_id=0,$street_id=0,$village_id=0){
$where = [];
if ($area_id){
$where[] = ['area_id', '=', $area_id];
}
if ($street_id){
$where[] = ['street_id', '=', $street_id];
}
if ($village_id){
$where[] = ['village_id', '=', $village_id];
}
$return = [
[
'name'=>'鸡',
'data'=>
[['month'=>'1月','value'=>'661'],
['month'=>'2月','value'=>'356'],
['month'=>'3月','value'=>'415'],
['month'=>'4月','value'=>'258'],
['month'=>'5月','value'=>'779'],
['month'=>'6月','value'=>'1465'],
['month'=>'7月','value'=>'668'],
['month'=>'8月','value'=>'571'],
['month'=>'9月','value'=>'498'],
['month'=>'10月','value'=>'587'],
['month'=>'11月','value'=>'881'],
['month'=>'12月','value'=>'1008']],
],
[
'name'=>'鸭',
'data'=>
[['month'=>'1月','value'=>'123'],
['month'=>'2月','value'=>'456'],
['month'=>'3月','value'=>'789'],
['month'=>'4月','value'=>'147'],
['month'=>'5月','value'=>'258'],
['month'=>'6月','value'=>'369'],
['month'=>'7月','value'=>'159'],
['month'=>'8月','value'=>'267'],
['month'=>'9月','value'=>'367'],
['month'=>'10月','value'=>'541'],
['month'=>'11月','value'=>'354'],
['month'=>'12月','value'=>'897']],
],
[
'name'=>'鹅',
'data'=>
[['month'=>'1月','value'=>'245'],
['month'=>'2月','value'=>'245'],
['month'=>'3月','value'=>'411'],
['month'=>'4月','value'=>'246'],
['month'=>'5月','value'=>'631'],
['month'=>'6月','value'=>'1234'],
['month'=>'7月','value'=>'546'],
['month'=>'8月','value'=>'246'],
['month'=>'9月','value'=>'356'],
['month'=>'10月','value'=>'466'],
['month'=>'11月','value'=>'744'],
['month'=>'12月','value'=>'998']],
]
];
$this->apiSuccess('获取成功',$return);
}
//养殖户产量分析
public function get_num24($area_id=0,$street_id=0,$village_id=0){
$where = [];
if ($area_id){
$where[] = ['area_id', '=', $area_id];
}
if ($street_id){
$where[] = ['street_id', '=', $street_id];
}
if ($village_id){
$where[] = ['village_id', '=', $village_id];
}
$return = [
['name' => '鸡','value'=>40],
['name' => '鸭','value'=>50],
['name' => '鹅','value'=>10],
];
$this->apiSuccess('获取成功',$return);
}
}