You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.9 KiB
73 lines
1.9 KiB
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Controller;
|
|
|
|
use Hyperf\DbConnection\Db;
|
|
use Hyperf\HttpServer\Annotation\AutoController;
|
|
use OSS\Core\OssException;
|
|
use OSS\OssClient;
|
|
|
|
/**
|
|
* @AutoController()
|
|
* Class StoreController
|
|
* @package App\Controller
|
|
*/
|
|
class StoreController extends BaseController
|
|
{
|
|
public function infoEdit()
|
|
{
|
|
|
|
$id = $this->request->input('id');
|
|
if (empty($id)){
|
|
return $this->result(1,[],'id不能为空');
|
|
}
|
|
$logo = $this->request->input('logo');
|
|
$name = $this->request->input('name');
|
|
$tel = $this->request->input('tel');
|
|
$address = $this->request->input('address');
|
|
$coordinates = $this->request->input('coordinates');
|
|
$capita = $this->request->input('capita');
|
|
$start_at = $this->request->input('start_at');
|
|
$announcement = $this->request->input('announcement');
|
|
$environment = $this->request->input('environment');
|
|
|
|
//>>1上传logo到阿里云oss
|
|
//>>2.上传商家环境到阿里云oss
|
|
//>>3.保存数据到数据库存
|
|
$fileName = $object = 'public/upload/' . date('Y') . '/' . date('m-d') . '/' . rand(0,9999999999999999).'.jpg';
|
|
$fileUpload = new FileUpload();
|
|
$resLogo = $fileUpload->ossUpload($logo,$fileName);
|
|
if (isset($resLogo['info']['http_code'])&&$resLogo['info']['http_code']==200){
|
|
$logo_url = $fileName;
|
|
}else{
|
|
return $this->result(1,[]);
|
|
}
|
|
$res = Db::table('ims_cjdc_store')->where('id',$id)->update([
|
|
'logo'=>$logo_url??"",
|
|
'name'=>$name,
|
|
'tel'=>$tel,
|
|
'address'=>$address,
|
|
'coordinates'=>$coordinates,
|
|
'capita'=>$capita,
|
|
'start_at'=>$start_at,
|
|
'announcement'=>$announcement,
|
|
'environment'=>$environment,
|
|
]);
|
|
return $this->success($res);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|