find($where); if (!$code) { $update = 1; } elseif ($update == 2) { return $code['file'] . '?v=' . time(); } if ($update == 1) { $wechat = new Wechat($project, 'wechat_applet'); $data = $wechat->curl('code', $param, true); if ($data) { $upload = Dever::load('upload/save')->copy('content,' . $data, 1, false, '', 'png', $filename); if (isset($upload['url'])) { $where['file'] = $upload['url']; $where['width'] = $param['width']; $where['env'] = $param['env_version']; if ($code) { $where['where_id'] = $code['id']; Dever::db('wechat_applet/code')->update($where); } else { Dever::db('wechat_applet/code')->insert($where); } return $upload['url'] . '?v=' . time(); } } } return false; /* $file = Dever::pathDay('upload/applet/code', false) . $project . '_' . md5($param['path'] . '_' . $param['param'] . '_' . $param['width']) . '.jpg'; if (!is_file($file) || $update == 1) { $wechat = new Wechat($project, 'wechat_applet'); $data = $wechat->curl('code', $param, true); if ($data) { file_put_contents($file, $data); } } //$host = str_replace(DEVER_PROJECT . '/' . DEVER_APP_NAME . '/', '', Dever::config('host')->base); $host = Dever::config('host')->host; if (strstr($file, '/share/dc/data/')) { return $host . str_replace('/share/dc/data/', '', $file); } return $host . str_replace(DEVER_PROJECT_PATH, '', $file); $file = Dever::pic($file); return $file; */ } }