InsertSql.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <?php
  2. /**
  3. * User: gq
  4. * Email: m@9026.com
  5. * Date: 2017/11/15
  6. * Time: 16:49
  7. */
  8. namespace App\Widget\Tools;
  9. use Illuminate\Support\Facades\DB;
  10. class InsertSql
  11. {
  12. // 免费模板 createCompanyInfo
  13. public static function createFreeInfo($appid)
  14. {
  15. \DB::table('cp_company_info')->insert(array (
  16. 0 =>
  17. array (
  18. 'appid' => $appid,
  19. 'name' => '公司名称',
  20. 'desc' => '公司简介',
  21. 'address' => '省市区地址',
  22. 'map' => '四川省成都市金牛区金泉街道蜀西路46-附23-24号盛大国际',
  23. 'lat' => '30.715277',
  24. 'lon' => '103.989748',
  25. 'detail_address' => '四川省成都市金牛区金泉街道蜀西路46-附23-24号盛大国际',
  26. 'start_time' => '09:00',
  27. 'end_time' => '18:00',
  28. 'phone' => '15281772600',
  29. 'pic' => env('APP_URL').'/upload/agent_pic/20171024/27d254fdcee75a632e9c9548f336403c.jpg',
  30. 'show' => env('APP_URL').'/upload/agent_show/20171024/faccf0bd12292b713f33238281454fe2.jpg',
  31. ),
  32. )
  33. );
  34. }
  35. // 公司模板 (跨域)
  36. public static function createCompanyInfo($uniacid)
  37. {
  38. // 创建幻灯片 分类 内容 表单设置 站点设置
  39. \DB::table('ims_yyf_company_slide')->insert(array (
  40. array (
  41. 'sortrank' => 0,
  42. 'images' => 'https://u5.9026.com/attachment/images/3/2017/10/f8yj7l8eGguH2EzilhfQqEzGeVZVlQ.png',
  43. 'uniacid' => $uniacid, //小程序id
  44. 'aid' => 0,
  45. ),
  46. array (
  47. 'sortrank' => 0,
  48. 'images' => 'https://u5.9026.com/attachment/images/3/2017/10/BnApna9DnhP4sOGeKHnVw4n53eOMO1.png',
  49. 'uniacid' => $uniacid,
  50. 'aid' => 0,
  51. ),
  52. array (
  53. 'sortrank' => 0,
  54. 'images' => 'https://u5.9026.com/attachment/images/3/2017/10/BnApna9DnhP4sOGeKHnVw4n53eOMO1.png',
  55. 'uniacid' => $uniacid,
  56. 'aid' => 0,
  57. ),
  58. )
  59. );
  60. \DB::table('ims_yyf_company_category')->insert(array (
  61. array (
  62. 'name' => '公司简介',
  63. 'sortrank' => 0,
  64. 'thumb' => 'https://u5.9026.com/attachment/images/3/2017/10/HhLn5T6nMo1MQGtqXoYtc11ncgtMNN.png',
  65. 'uniacid' => $uniacid,
  66. 'type' => 3,
  67. 'content' => '',
  68. 'isshow' => 1,
  69. 'isshow_nav' => 0,
  70. 'show_num' => 4,
  71. 'fid' => 0,
  72. ),
  73. array (
  74. 'name' => '公司案列',
  75. 'sortrank' => 0,
  76. 'thumb' => 'https://u5.9026.com/attachment/images/3/2017/10/FE9Ly9Bf7ZTyLe7zSlftZ98K3N0l3t.png',
  77. 'uniacid' => $uniacid,
  78. 'type' => 1,
  79. 'content' => '',
  80. 'isshow' => 1,
  81. 'isshow_nav' => 0,
  82. 'show_num' => 4,
  83. 'fid' => 0,
  84. ),
  85. array (
  86. 'name' => '新闻资讯',
  87. 'sortrank' => 0,
  88. 'thumb' => 'https://u5.9026.com/attachment/images/3/2017/10/YxHtw0v8toT8ztvZWTK8tTcHs486t6.png',
  89. 'uniacid' => $uniacid,
  90. 'type' => 2,
  91. 'content' => '',
  92. 'isshow' => 1,
  93. 'isshow_nav' => 0,
  94. 'show_num' => 4,
  95. 'fid' => 0,
  96. ),
  97. )
  98. );
  99. // 获取分类最后插入记录的id
  100. $last_id = \DB::table('ims_yyf_company_category')->insertGetId(
  101. array (
  102. 'name' => '服务内容',
  103. 'sortrank' => 0,
  104. 'thumb' => 'https://u5.9026.com/attachment/images/3/2017/10/YxHtw0v8toT8ztvZWTK8tTcHs486t6.png',
  105. 'uniacid' => $uniacid,
  106. 'type' => 1,
  107. 'content' => '',
  108. 'isshow' => 1,
  109. 'isshow_nav' => 0,
  110. 'show_num' => 4,
  111. 'fid' => 0,
  112. )
  113. );
  114. \DB::table('ims_yyf_company_news')->insert(array (
  115. array (
  116. 'title' => '微信开发',
  117. 'cid' => $last_id,
  118. 'thumb' => 'https://u5.9026.com/attachment/images/3/2017/10/knWWN1p14S9o3mZ69X55S0xZnFSOEF.png',
  119. 'uniacid' => $uniacid,
  120. 'addtime' => time(),
  121. 'content' => '这里是微信开发内容',
  122. 'sortrank' => 1,
  123. 'videosrc' => '',
  124. 'appid' => '',
  125. 'pageaddress' => '',
  126. ),
  127. array (
  128. 'title' => '新闻资讯的标题',
  129. 'cid' => $last_id-1,
  130. 'thumb' => 'https://u5.9026.com/attachment/images/3/2017/10/knWWN1p14S9o3mZ69X55S0xZnFSOEF.png',
  131. 'uniacid' => $uniacid,
  132. 'addtime' => time(),
  133. 'content' => '这里是新闻资讯的标题内容',
  134. 'sortrank' => 1,
  135. 'videosrc' => '',
  136. 'appid' => '',
  137. 'pageaddress' => '',
  138. ),
  139. array (
  140. 'title' => '电商小程序',
  141. 'cid' => $last_id-2,
  142. 'thumb' => 'https://u5.9026.com/attachment/images/3/2017/10/knWWN1p14S9o3mZ69X55S0xZnFSOEF.png',
  143. 'uniacid' => $uniacid,
  144. 'addtime' => time(),
  145. 'content' => '这里是电商小程序内容',
  146. 'sortrank' => 1,
  147. 'videosrc' => '',
  148. 'appid' => '',
  149. 'pageaddress' => '',
  150. ),
  151. )
  152. );
  153. // 获取公司简介的文章id
  154. $news_id = \DB::table('ims_yyf_company_news')->insertGetId(
  155. array (
  156. 'title' => '公司简介的标题',
  157. 'cid' => $last_id-3,
  158. 'thumb' => 'https://u5.9026.com/attachment/images/3/2017/10/knWWN1p14S9o3mZ69X55S0xZnFSOEF.png',
  159. 'uniacid' => $uniacid,
  160. 'addtime' => time(),
  161. 'content' => '这里是公司简介的内容',
  162. 'sortrank' => 1,
  163. 'videosrc' => '',
  164. 'appid' => '',
  165. 'pageaddress' => '',
  166. )
  167. );
  168. \DB::table('ims_yyf_company_form')->insert(array (
  169. array (
  170. 'uniacid' => $uniacid,
  171. 't1name' => '姓名',
  172. 't1full' => 0,
  173. 't1show' => 1,
  174. 't2name' => '联系方式',
  175. 't2full' => 0,
  176. 't2show' => 1,
  177. 't3name' => '邮箱',
  178. 't3full' => 0,
  179. 't3show' => 1,
  180. 't4name' => '其他',
  181. 't4full' => 0,
  182. 't4show' => 1,
  183. 'rname' => '',
  184. 'rvalue' => '',
  185. 'rfull' => 0,
  186. 'rshow' => 0,
  187. 'cname' => '',
  188. 'cvalue' => '',
  189. 'cfull' => 0,
  190. 'cshow' => 0,
  191. 'aname' => '请输入您的意见',
  192. 'afull' => 0,
  193. 'ashow' => 1,
  194. 'desc' => '在线留言',
  195. 'catname' => '在线留言',
  196. 'interval' => 1,
  197. 'successtext' => '提交成功',
  198. ),
  199. )
  200. );
  201. \DB::table('ims_yyf_company_tabbar')->insert(array (
  202. array (
  203. 'uniacid' => $uniacid,
  204. 'm1_name' => '首页',
  205. 'm2_name' => '公司简介',
  206. 'm3_name' => '联系我们',
  207. 'm4_name' => '业务咨询',
  208. 'm1_path' => 'index',
  209. 'm2_path' => "a{$news_id}", //分类id 或是文章id 文章id前缀a 例a393
  210. 'm3_path' => 'contact',
  211. 'm4_path' => 'message',
  212. 'm1_img' => 'https://u5.9026.com/attachment/images/3/2017/10/EyYSVysAqWYya1vmV1HmHsuJaM2uj9.png',
  213. 'm2_img' => 'https://u5.9026.com/attachment/images/3/2017/10/W6aWlUAi6F2LdaQf2fcccFzClAFcLZ.png',
  214. 'm3_img' => 'https://u5.9026.com/attachment/images/3/2017/10/XDNuwYdF9du0cWJNc4Nu9dDM9ufYD4.png',
  215. 'm4_img' => 'https://u5.9026.com/attachment/images/3/2017/10/knWWN1p14S9o3mZ69X55S0xZnFSOEF.png',
  216. 'm1_selimg' => 'https://u5.9026.com/attachment/images/3/2017/10/EyYSVysAqWYya1vmV1HmHsuJaM2uj9.png',
  217. 'm2_selimg' => 'https://u5.9026.com/attachment/images/3/2017/10/W6aWlUAi6F2LdaQf2fcccFzClAFcLZ.png',
  218. 'm3_selimg' => 'https://u5.9026.com/attachment/images/3/2017/10/XDNuwYdF9du0cWJNc4Nu9dDM9ufYD4.png',
  219. 'm4_selimg' => 'https://u5.9026.com/attachment/images/3/2017/10/knWWN1p14S9o3mZ69X55S0xZnFSOEF.png',
  220. 'border_color' => '#ffffff',
  221. 'background_color' => '#ffffff',
  222. 'color' => '#d9d9d9',
  223. 'sel_color' => '#666666',
  224. ),
  225. )
  226. );
  227. // 站点设置 设置首页的标题 联系我们的信息等
  228. \DB::table('ims_yyf_company_sysinfo')->insert(array (
  229. array (
  230. 'uniacid' => $uniacid,
  231. 'title' => '首页网站标题',
  232. 'notice' => '网站公告',
  233. 'phone' => '13880988888',
  234. 'jing' => '30.714650',
  235. 'wei' => '103.990120',
  236. 'qq' => 12345678,
  237. 'address' => '蜀西路',
  238. 'email' => '88qq.com',
  239. 'copyright' => '底部版权信息',
  240. 'name' => '首页转发标题',
  241. 'message_email' => '88qq.com',
  242. 'message_title' => '您有新的业务咨询',
  243. 'smtp_email' => '88qq.com',
  244. 'smtp_key' => '授权码',
  245. ),
  246. )
  247. );
  248. // 联系我们页数据 图片 公司log 名称
  249. \DB::table('ims_yyf_company_style')->insert(array (
  250. array (
  251. 'uniacid' => $uniacid,
  252. 'tcolor' => '#2d7dee',
  253. 'slide_close' => '0',
  254. 'nav_close' => '0',
  255. 'notice_close' => '0',
  256. 'custom_close' => '0',
  257. 'contact_background' => 'https://u5.9026.com/attachment/images/3/2017/10/eu80NQI0M9q70NTMg0MAfUG0FDu0gN.png', //联系我们背景图片
  258. 'contact_name' => 'xxx公司名称',
  259. 'contact_logo' => 'https://u5.9026.com/attachment/images/3/2017/10/eu80NQI0M9q70NTMg0MAfUG0FDu0gN.png', //公司log
  260. 'horn' => 'https://u5.9026.com/attachment/images/3/2017/10/knWWN1p14S9o3mZ69X55S0xZnFSOEF.png', //首页公告栏图标
  261. 'title_style' => '0',
  262. 'nav_style' => '0',
  263. 'slide_height' => '330',
  264. ),
  265. )
  266. );
  267. }
  268. // 高级商城
  269. public static function createMallInfo($uniacid,$user_id)
  270. {
  271. // 商城设置 插入两张表
  272. $name = DB::connection('we7')->select("select name from `ims_uni_account` where uniacid=$uniacid"); //小程序名称
  273. DB::connection('we7')->insert("INSERT INTO `hjmall_wechat_app` VALUES (null,$uniacid,$user_id,$name,'wx7881c559997a5d6d','62110047ee7ac85d4e915aecdd397493',NULL,'1398823402','c1891122765718911227657189112276','a7acea59b817587','09bfb8f08dec066d2',time(),0);");
  274. DB::connection('we7')->insert("INSERT INTO `hjmall_store` VALUES
  275. (null,0,0,$uniacid,$user_id,0,1,'演示分销商城','','13888888888',1,'底部版权文字','https://u5.9026.com/addons/zjhj_mall/core/web/uploads/image/67/67ee41430bc96c6848a49eee7a6d6be3.png',
  276. '/pages/article-detail/article-detail?id=about_us',10,7,0,'888','apikey',3,'[{\"name\":\"banner\"},{\"name\":\"search\"},{\"name\":\"nav\"},{\"name\":\"topic\"},{\"name\":\"coupon\"},{\"name\":\"single_cat-1\"},{\"name\":\"banner\"},{\"name\":\"coupon\"},{\"name\":\"coupon\"},{\"name\":\"coupon\"}]','',3,0,0,1,6,1);");
  277. // 首页排版
  278. DB::connection('we7')->insert("INSERT INTO `hjmall_home_block` VALUES (null,1,'案例展示','{\"pic_list\":[{\"pic_url\":\"https:\/\/u5.9026.com\/addons\/zjhj_mall\/core\/web\/uploads\/image\/a7\/a7acea59b81758709bfb8f08dec066d2.jpg\",\"url\":\"\",\"open_type\":\"\"}]}',time(),0);");
  279. // 门店设置
  280. $store_id = DB::connection('we7')->select("select id from `hjmall_store` where uniacid=$uniacid where user_id=$user_id");
  281. DB::connection('we7')->insert("INSERT INTO `hjmall_shop` VALUES (null,$store_id,'门店1','13880642883','蜀西路100号',0,time());");
  282. }
  283. public static function createBaseMallInfo($uniacid)
  284. {
  285. }
  286. // 基础商城
  287. }