<?php
namespace app\api\controller;
use app\api\service\RedPaper;
use app\api\service\UserService;
use app\api\service\WxCompany;
use app\common\Tension;
use app\urge\controller\Upload;
use think\Db;
use think\Debug;
use think\Request;
class User extends Base
{
public function book()
{
return 1;
}
public function get_user_info()
{
$rs = ["status" => "success"];
if ($this->user_info) {
$rs["msg"] = "获取成功!";
$info = $this->user_info;
$info["is_vip"] = $this->get_user_vip($info["id"]);
if ($info["vip_end_time"] > time()) {
$info["vip_end_time"] = date("Y-m-d", $info["vip_end_time"]) . "到期";
} else {
$info["vip_end_time"] = 0;
}
$trailing = Db::name("user_trailing")->where("user_id", $info["id"])->count();
$info["trailing"] = formatNumber($trailing);
$paper = Db::name("paper")->where("user_id", $info["id"])->count();
$info["paper"] = formatNumber($paper);
$user_track = Db::name("user_track")->where("at_user_id", $info["id"])->count();
$info["user_track"] = formatNumber($user_track);
$user_fs = Db::name("user_track")->where("qu_user_id", $info["id"])->count();
$info["user_fs"] = formatNumber($user_fs);
$info["autograph"] = emoji_decode($info["autograph"]);
$info["is_nick_name"] = false;
$info["is_nick_name_end"] = 0;
if ($info["is_vip"] == 0) {
if ($info["nick_name_time"] + 90 * 86400 > time()) {
$info["is_nick_name_end"] = date("Y-m-d H:i:s", $info["nick_name_time"] + 90 * 86400);
$info["is_nick_name"] = true;
}
}
if ($info["is_vip"] == 1) {
if ($info["nick_name_time"] + 30 * 86400 > time()) {
$info["is_nick_name_end"] = date("Y-m-d H:i:s", $info["nick_name_time"] + 30 * 86400);
$info["is_nick_name"] = true;
}
}
$check = Db::name("user_punch")->whereTime("punch_time", "today")->where("user_id", $info["id"])->order("punch_time desc")->count();
$info["is_sign"] = $check;
$user_male = Db::name("user_smail")->where("user_id", $info["id"])->where("status", 0)->count();
$info["user_male"] = $user_male;
$user_yzm = Db::name("user_invitation_code")->where("user_id", $info["id"])->find();
if (empty($user_yzm)) {
$yzm = $this->get_yzm_random(6);
Db::name("user_invitation_code")->insert(["user_id" => $info["id"], "code" => $yzm, "much_id" => $this->much_id]);
}
$ji_bei = Db::name("user_currency_conversion")->where("user_id", $info["id"])->where("much_id", $this->much_id)->where("conver_type", 1)->whereTime("conver_time", "today")->count();
$bei_ji = Db::name("user_currency_conversion")->where("user_id", $info["id"])->where("much_id", $this->much_id)->where("conver_type", 0)->whereTime("conver_time", "today")->count();
$info["ji_bei"] = $ji_bei;
$info["bei_ji"] = $bei_ji;
$rs["info"] = $info;
} else {
$rs["status"] = "error";
$rs["msg"] = "系统忙,请稍候重试!";
}
return json_encode($rs);
}
public function add_user_punch()
{
$data = input("param.");
$user_info = Db::name("user")->where("id", $this->user_info["id"])->where("much_id", $data["much_id"])->find();
$check = Db::name("user_punch")->whereTime("punch_time", "today")->where("user_id", $this->user_info["id"])->where("much_id", $data["much_id"])->order("punch_time desc")->find();
if ($check) {
$rs = ["status" => "error", "msg" => "今天已经签过,请明天再来!"];
return json_encode($rs);
}
Db::startTrans();
$is_vip = $this->get_user_vip($this->user_info["id"]);
$punch_range = Db::name("user_punch_range")->where("much_id", $data["much_id"])->find();
if ($is_vip == 1) {
$fraction = rand($punch_range["noble_min"] * 100, $punch_range["noble_max"] * 100) / 100;
} else {
$fraction = rand($punch_range["aver_min"] * 100, $punch_range["aver_max"] * 100) / 100;
}
try {
$ins = Db::name("user_punch")->insert(["user_id" => $this->user_info["id"], "fraction" => $fraction, "punch_time" => time(), "much_id" => $data["much_id"]]);
if (!$ins) {
Db::rollback();
$rs = ["status" => "error", "msg" => "签到失败,请稍候重试"];
return json_encode($rs);
}
$am["user_id"] = $this->user_info["id"];
$am["category"] = 3;
$am["poem_fraction"] = $user_info["fraction"];
$am["surplus_fraction"] = $user_info["fraction"] + $fraction;
$am["finance"] = $fraction;
$am["ruins_time"] = time();
$am["solution"] = "每日签到赠送" . $this->design["confer"];
$am["evaluate"] = 1;
$am["much_id"] = $data["much_id"];
$user_amount = Db::name("user_amount")->insert($am);
if (!$user_amount) {
Db::rollback();
$rs = ["status" => "error", "msg" => "签到失败,请稍候重试"];
return json_encode($rs);
}
$user_up = Db::name("user")->where("id", $this->user_info["id"])->where("much_id", $data["much_id"])->update(["fraction" => $am["surplus_fraction"]]);
if (!$user_up) {
Db::rollback();
$rs = ["status" => "error", "msg" => "签到失败,请稍候重试"];
return json_encode($rs);
}
Db::commit();
$rs = ["status" => "success", "msg" => "签到成功!" . $this->design["confer"] . "增加" . $fraction . $this->design["confer"]];
return json_encode($rs);
} catch (\Exception $e) {
Db::rollback();
$rs = ["status" => "error", "msg" => "签到失败,请稍候重试" . $e->getMessage()];
return json_encode($rs);
}
}
public function edit_user_info()
{
$rs = ["status" => "success", "msg" => "保存成功"];
$data = input("param.");
$user_info = Db::name("user")->where("id", $this->user_info["id"])->where("much_id", $data["much_id"])->find();
$user_list = Db::name("user")->where("id", "<>", $this->user_info["id"])->where("much_id", $data["much_id"])->where("user_nick_name", emoji_encode($data["nick_name"]))->find();
if ($user_list) {
$rs = ["status" => "error", "msg" => "昵称已存在,换个吧"];
return json_encode($rs);
}
if (emoji_encode($data["nick_name"]) != $user_info["user_nick_name"]) {
$up["user_nick_name"] = emoji_encode($data["nick_name"]);
$up["nick_name_time"] = emoji_encode($data["nick_name"]) == $user_info["user_nick_name"] ? 0 : time();
}
$up["user_head_sculpture"] = $data["img"];
$up["gender"] = $data["gender"];
$up["autograph"] = emoji_encode($data["autograph"]);
$up["user_head_sculpture"] = $data["img"];
$update = Db::name("user")->where("id", $this->user_info["id"])->where("much_id", $data["much_id"])->update($up);
if ($update !== false) {
return json_encode($rs);
} else {
$rs = ["status" => "error", "msg" => "保存失败"];
return json_encode($rs);
}
}
public function get_index_list()
{
$rs = ["status" => "success", "msg" => "获取成功"];
$data = input("param.");
$where = [];
$where_not_in = [];
$page = $data["index_page"];
if (isset($data
没有合适的资源?快使用搜索试试~ 我知道了~
榆落微时光小程序1.0.39.zip
共1750个文件
php:751个
png:330个
js:179个
5星 · 超过95%的资源 需积分: 33 24 下载量 110 浏览量
2020-03-26
15:49:42
上传
评论 2
收藏 18.94MB ZIP 举报
温馨提示
淘宝买的,运行没问题,就是消息模板被封了,需要的自己修改二开,可是用于社区团购,企业内部小论坛,反正功能多多,可是试试
资源推荐
资源详情
资源评论
收起资源包目录
榆落微时光小程序1.0.39.zip (1750个子文件)
amazeui.min.css 249KB
bootstrap.min.css 98KB
app.css 38KB
layer.css 14KB
style.css 7KB
admin.css 5KB
layer.css 5KB
comboboxmenu.css 4KB
buttonicon.css 3KB
image.css 3KB
video.css 3KB
emotion.css 2KB
dialog.css 2KB
combobox.css 1KB
editor.css 1KB
colorpicker.css 1KB
tab.css 976B
splitbutton.css 931B
formula.css 838B
button.css 781B
tooltip.css 758B
blue.css 519B
popup.css 457B
dialogsize.css 393B
umeditor.css 312B
separator.css 304B
phpunit.xml.dist 2KB
phpunit.xml.dist 893B
build.properties.dist 391B
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
fontawesome-webfont.eot 75KB
wface.gif 49KB
jxface2.gif 40KB
yface.gif 28KB
bface.gif 27KB
icons.gif 20KB
tface.gif 19KB
fface.gif 18KB
yuyin.gif 15KB
cface.gif 8KB
yuyin.gif 6KB
loading-0.gif 6KB
005.gif 3KB
home_yuyim1.gif 2KB
loading-2.gif 2KB
videologo.gif 2KB
ok.gif 866B
loading-1.gif 701B
0.gif 43B
spacer.gif 43B
wallet.html 27KB
navigate.html 23KB
seorder.html 21KB
annex.html 19KB
setails.html 19KB
upshop.html 18KB
rushop.html 18KB
shop.html 16KB
reticraphic.html 16KB
savour.html 15KB
supervise_images.html 13KB
safety.html 13KB
report.html 13KB
pinhead.html 13KB
sminor.html 13KB
switch_control.html 13KB
usmur.html 13KB
spread.html 13KB
theoretic.html 12KB
fence.html 12KB
appeal.html 11KB
dialog_images.html 11KB
base.html 11KB
gift_ranking.html 11KB
receiving_ranking.html 10KB
repas.html 10KB
uplfence.html 10KB
index.html 10KB
message.html 10KB
awake.html 10KB
home_topping.html 10KB
rulfence.html 10KB
index.html 9KB
material.html 9KB
austive.html 9KB
upsymbol.html 9KB
setting.html 9KB
rusymbol.html 9KB
solicit.html 9KB
index.html 8KB
friendly.html 8KB
nav.html 8KB
help.html 8KB
sorder.html 8KB
topping.html 8KB
stype.html 8KB
audit.html 8KB
共 1750 条
- 1
- 2
- 3
- 4
- 5
- 6
- 18
资源评论
- lichunrui002021-04-23你好 可以帮搭建吗
贝勒爷M
- 粉丝: 4
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功