/**
* Created by PhpStorm.
* User: Administrator
* Date: 2015/8/25
* Time: 15:16
* 接口功能:
* 我的
* tshouru 今天收入
* yshouru 昨天收入
* zhichu 支出
* tel 其他联系方式
* customer_alias 用户姓名
* charge 余额
*
* 参数:
* 无
* 成功:
* {"status":1,"info":获取成功,"content":{"tshouru":300,"yshouru":20,"zhichu":50}}
*
*
* 失败:
*
*
*
*/
require_once './dbconnect_utf.php';
$token=$_SERVER['HTTP_TOKEN'];
$token=base64_decode($token);
$tokenArr=explode("|",$token);
$uid=$tokenArr[3]?$tokenArr[3]:3433;
$info=getcustomerinfo($uid);
$charge=getcustomercharge($uid);
$yestoday=date('Y-m-d',strtotime('-1 days'));
echo $yestoday;
$tshouru=gettshouru($uid);
$yshouru=gettshouru($uid);
$isshouxin=getinfo($uid);//1:申请中 2:已同意 3:已拒绝 0申请中 1.可以授信
$temp=array("tshouru"=>300.00,"yshouru"=>20.00,"zhichu"=>50.00,"customer_alias"=>$info['customer_alias'],"yaoqingma"=>$info['yaoqinma'],"tel"=>$info['tel'],"charge"=>$charge?$charge:0,"isshouxin"=>$isshouxin);
$date=array("status"=>1,"info"=>"成功","content"=>$temp);
echo json_encode($date);
function getinfo($uid){
$sql=sprintf("select * from credit_apply where apply_uid=%d",$uid);
//echo $sql;
$q=mysql_query($sql);
while($r=mysql_fetch_array($q)){
if($r['status']==1){
$result=0;
break;
}else{
$result=1;
}
}
return $result;
}
function getcustomerinfo($uid){
$sql=sprintf("select * from blog_express_customer where customer_id=%d",$uid);
//echo $sql;
$q=mysql_query($sql);
$r=mysql_fetch_array($q);
return $r;
}
function getcustomercharge($uid){
$sql=sprintf("select * from mall_charge where uid=%d",$uid);
$q=mysql_query($sql);
$r=mysql_fetch_array($q);
return $r['totalnum'];
}
function gettshouru($uid,$nowdate=""){
if($nowdate){
$today_start = strtotime($nowdate." 00:00:00");
$today_end = strtotime($nowdate." 23:59:59");
}else{
$today = date('Y-m-d',time());
$today_start = strtotime($today." 00:00:00");
$today_end = time();
}
$where="and create_time >$today_start and create_time< $today_end ";
$sql="select FROM_UNIXTIME(create_time, '%Y-%m-%d' ) as time,sum(money) as money from mall_count_water where uid=$uid and (come_way=4 or come_way=5 or come_way=1) $where GROUP BY time order by time DESC ";
$q=mysql_query($sql);
$result=mysql_fetch_array($q);
return $result['money'];
}
一键复制
编辑
Web IDE
原始数据
按行查看
历史