文件
mashangyoujiu/Application/SmallProgramApi/Controller/ImageController.class.php

52 行
1.4 KiB
PHP
可执行文件

<?php
namespace SmallProgramApi\Controller;
use Think\Controller;
//[1.4.13]
class ImageController extends BaseController
{
public function _initialize()
{
parent::_initialize();
if (empty(self::$store_id)) {
$result['status'] = 0;
$result['msg'] = '缺少门店ID';
$this->ajaxReturn($result);
}
}
/*
* 图片上传
*/
public function reason_img()
{
$merchant_id = self::$merchant_id;
$store_id = self::$store_id;
$item_arr = array(
'add_time' => time(),
'from_type_id' => 48,
'localUrl' => 'Store/Reason',
'user_type' => 6,
'merchant_id' => $merchant_id,
'store_id' => $store_id
);
$uploads = uploadFiles($item_arr);//上传图片
foreach(array_keys($uploads) as $key) {
if (!empty($uploads[$key])) {
$res['status'] = 1;
$res[$key . '_id'] = $uploads[$key]['id']; //商品展示图片
$res['path'] = $uploads[$key]['path']; //商品展示图片
} else {
$res['status'] = 0;
$res['path'] = '图片上传失败';
$res['status'] = 0;
}
}
$this->ajaxReturn($res);
}
public function upload() {
$this->reason_img();
}
}